mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-19 15:01:06 +08:00
fix(block-dev): Render props when mocking Link and Icon in stubBlockProps.
This commit is contained in:
parent
0d285347cd
commit
b6b50c842a
@ -22,12 +22,20 @@ import schemaTest from './schemaTest.js';
|
||||
|
||||
const validate = {};
|
||||
const Icons = {
|
||||
AiIcon: (props) => <svg {...props} data-testid="AiIcon"></svg>,
|
||||
AiOutlineExclamationCircle: (props) => (
|
||||
<svg {...props} data-testid="AiOutlineExclamationCircle"></svg>
|
||||
AiIcon: ({ onClick, ...props }) => (
|
||||
<svg data-testid="AiIcon" onClick={onClick}>
|
||||
ICON PROPS: {JSON.stringify(props)}
|
||||
</svg>
|
||||
),
|
||||
AiOutlineLoading3Quarters: (props) => (
|
||||
<svg {...props} data-testid="AiOutlineLoading3Quarters"></svg>
|
||||
AiOutlineExclamationCircle: ({ onClick, ...props }) => (
|
||||
<svg data-testid="AiOutlineExclamationCircle" onClick={onClick}>
|
||||
ICON PROPS: {JSON.stringify(props)}
|
||||
</svg>
|
||||
),
|
||||
AiOutlineLoading3Quarters: ({ onClick, ...props }) => (
|
||||
<svg data-testid="AiOutlineLoading3Quarters" onClick={onClick}>
|
||||
ICON PROPS: {JSON.stringify(props)}
|
||||
</svg>
|
||||
),
|
||||
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) => (
|
||||
<a data-testid={`link-${props.href}`} {...props}>
|
||||
{props.children}
|
||||
Link: ({ id, children, onClick, ...props }) => (
|
||||
<a data-testid={id} onClick={onClick}>
|
||||
LINK PROPS:{JSON.stringify(props)} - CHILDREN: {children('default_title')}
|
||||
</a>
|
||||
),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user