From b6b50c842a84bd74adcf6f053de5902124a3f460 Mon Sep 17 00:00:00 2001 From: Gervwyk Date: Thu, 3 Mar 2022 11:18:49 +0200 Subject: [PATCH] fix(block-dev): Render props when mocking Link and Icon in stubBlockProps. --- .../utils/block-dev/src/stubBlockProps.js | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/utils/block-dev/src/stubBlockProps.js b/packages/utils/block-dev/src/stubBlockProps.js index 4b011225e..ede7f475f 100644 --- a/packages/utils/block-dev/src/stubBlockProps.js +++ b/packages/utils/block-dev/src/stubBlockProps.js @@ -22,12 +22,20 @@ import schemaTest from './schemaTest.js'; const validate = {}; const Icons = { - AiIcon: (props) => , - AiOutlineExclamationCircle: (props) => ( - + AiIcon: ({ onClick, ...props }) => ( + + ICON PROPS: {JSON.stringify(props)} + ), - AiOutlineLoading3Quarters: (props) => ( - + AiOutlineExclamationCircle: ({ onClick, ...props }) => ( + + ICON PROPS: {JSON.stringify(props)} + + ), + AiOutlineLoading3Quarters: ({ onClick, ...props }) => ( + + ICON PROPS: {JSON.stringify(props)} + ), ErrorIcon: () => { throw new Error('ErrorIcon'); @@ -64,9 +72,9 @@ const stubBlockProps = ({ block, meta, logger = () => null, initialValue, schema block.eventLog = []; block.components = { Icon: IconComponent, - Link: (props) => ( - - {props.children} + Link: ({ id, children, onClick, ...props }) => ( + + LINK PROPS:{JSON.stringify(props)} - CHILDREN: {children('default_title')} ), };