mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-02-17 14:30:34 +08:00
Merge branch 'develop' into package-updates
This commit is contained in:
commit
3c42d44d03
@ -20,10 +20,19 @@ import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
import mockBlock from './mockBlock';
|
||||
|
||||
const runMockRenderTests = ({ Block, enzyme, examples, logger, meta, mocks }) => {
|
||||
const runMockRenderTests = ({
|
||||
Block,
|
||||
enzyme,
|
||||
examples,
|
||||
logger,
|
||||
meta,
|
||||
mocks,
|
||||
reset = () => null,
|
||||
}) => {
|
||||
const { before, methods, getProps } = mockBlock({ meta, logger });
|
||||
|
||||
beforeEach(() => {
|
||||
reset();
|
||||
before();
|
||||
});
|
||||
const values = meta.values
|
||||
|
@ -24,12 +24,7 @@ const AlertBlock = ({ blockId, events, methods, properties }) => {
|
||||
const additionalProps = {};
|
||||
if (properties.icon) {
|
||||
additionalProps.icon = (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.icon}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
);
|
||||
}
|
||||
return (
|
||||
|
@ -65,7 +65,6 @@ const AnchorBlock = ({ blockId, events, loading, methods, properties }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={showLoading ? { name: 'LoadingOutlined', spin: true } : properties.icon}
|
||||
/>
|
||||
)}
|
||||
|
@ -41,7 +41,6 @@ const AutoCompleteInput = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<AutoComplete
|
||||
|
@ -37,12 +37,7 @@ const AvatarBlock = ({ blockId, events, methods, properties }) => (
|
||||
])}
|
||||
icon={
|
||||
properties.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
properties={properties.icon}
|
||||
methods={methods}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
)
|
||||
}
|
||||
>
|
||||
|
@ -26,12 +26,7 @@ const BadgeBlock = ({ blockId, events, content, properties, methods }) => (
|
||||
color={properties.color}
|
||||
count={
|
||||
(properties.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
properties={properties.icon}
|
||||
methods={methods}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
)) ||
|
||||
properties.count
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { type } from '@lowdefy/helpers';
|
||||
import { type, get } from '@lowdefy/helpers';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { blockDefaultProps } from '@lowdefy/block-tools';
|
||||
@ -39,47 +39,49 @@ const ItemLink = ({ link, children, className }) => {
|
||||
return <span className={className}>{children}</span>;
|
||||
};
|
||||
|
||||
const BreadcrumbBlock = ({ blockId, events, methods, properties }) => (
|
||||
<Breadcrumb
|
||||
id={blockId}
|
||||
separator={properties.separator}
|
||||
className={methods.makeCssClass(properties.style)}
|
||||
>
|
||||
{(properties.list || []).map((link, index) => (
|
||||
<Breadcrumb.Item
|
||||
key={index}
|
||||
onClick={
|
||||
events.onClick &&
|
||||
(() => methods.triggerEvent({ name: 'onClick', event: { link, index } }))
|
||||
}
|
||||
>
|
||||
<ItemLink
|
||||
className={methods.makeCssClass([
|
||||
{
|
||||
cursor: events.onClick && 'pointer',
|
||||
},
|
||||
link.style,
|
||||
])}
|
||||
link={link}
|
||||
const BreadcrumbBlock = ({ blockId, events, methods, properties, rename }) => {
|
||||
const onClickActionName = get(rename, 'events.onClick', { default: 'onClick' });
|
||||
return (
|
||||
<Breadcrumb
|
||||
id={blockId}
|
||||
separator={properties.separator}
|
||||
className={methods.makeCssClass(properties.style)}
|
||||
>
|
||||
{(properties.list || []).map((link, index) => (
|
||||
<Breadcrumb.Item
|
||||
key={index}
|
||||
onClick={
|
||||
events[onClickActionName] &&
|
||||
(() => methods.triggerEvent({ name: onClickActionName, event: { link, index } }))
|
||||
}
|
||||
>
|
||||
{link.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_${index}_icon`}
|
||||
events={events}
|
||||
properties={{
|
||||
name: type.isString(link.icon) && link.icon,
|
||||
...(type.isObject(link.icon) ? link.icon : {}),
|
||||
style: { paddingRight: 8, ...(link.icon.style || {}) },
|
||||
}}
|
||||
methods={methods}
|
||||
/>
|
||||
)}
|
||||
{type.isString(link) ? link : link.label || link.pageId || link.url || `Link ${index}`}
|
||||
</ItemLink>
|
||||
</Breadcrumb.Item>
|
||||
))}
|
||||
</Breadcrumb>
|
||||
);
|
||||
<ItemLink
|
||||
className={methods.makeCssClass([
|
||||
{
|
||||
cursor: events[onClickActionName] && 'pointer',
|
||||
},
|
||||
link.style,
|
||||
])}
|
||||
link={link}
|
||||
>
|
||||
{link.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_${index}_icon`}
|
||||
events={events}
|
||||
properties={{
|
||||
name: type.isString(link.icon) && link.icon,
|
||||
...(type.isObject(link.icon) ? link.icon : {}),
|
||||
style: { paddingRight: 8, ...(link.icon.style || {}) },
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{type.isString(link) ? link : link.label || link.pageId || link.url || `Link ${index}`}
|
||||
</ItemLink>
|
||||
</Breadcrumb.Item>
|
||||
))}
|
||||
</Breadcrumb>
|
||||
);
|
||||
};
|
||||
|
||||
BreadcrumbBlock.defaultProps = blockDefaultProps;
|
||||
|
||||
|
@ -52,12 +52,7 @@ const ButtonBlock = ({ blockId, events, loading, methods, onClick, properties, r
|
||||
type={get(properties, 'type', { default: 'primary' })}
|
||||
icon={
|
||||
properties.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.icon}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
)
|
||||
}
|
||||
onClick={onClick || (() => methods.triggerEvent({ name: onClickActionName }))}
|
||||
|
@ -42,7 +42,6 @@ const ButtonSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<Radio.Group
|
||||
|
@ -42,7 +42,6 @@ const CheckboxSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<Checkbox.Group
|
||||
|
@ -49,7 +49,6 @@ const CollapseBlock = ({ blockId, events, content, methods, properties }) => {
|
||||
blockId={`${blockId}_expandIcon`}
|
||||
events={events}
|
||||
properties={{ rotate: isActive ? 90 : 0, ...propertiesIconExpand }}
|
||||
methods={methods}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ const CommentBlock = ({ blockId, content, properties, methods }) => {
|
||||
author={properties.author || (content.author && content.author())}
|
||||
content={properties.content || (content.content && content.content())}
|
||||
datetime={properties.datetime}
|
||||
avatar={<Avatar methods={methods} properties={avatar} />}
|
||||
avatar={<Avatar properties={avatar} />}
|
||||
>
|
||||
{content.children && content.children()}
|
||||
</Comment>
|
||||
|
@ -25,12 +25,7 @@ const ConfirmModal = ({ blockId, events, content, methods, properties }) => {
|
||||
const additionalProps = {};
|
||||
if (properties.icon) {
|
||||
additionalProps.icon = (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
properties={properties.icon}
|
||||
methods={methods}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
);
|
||||
}
|
||||
methods.triggerEvent({ name: 'onOpen' });
|
||||
|
@ -70,7 +70,6 @@ const ControlledListBlock = ({ blockId, events, properties, list, methods }) =>
|
||||
icon: 'PlusOutlined',
|
||||
...properties.addItemButton,
|
||||
}}
|
||||
methods={methods}
|
||||
onClick={() => methods.unshiftItem()}
|
||||
/>
|
||||
)}
|
||||
@ -92,7 +91,6 @@ const ControlledListBlock = ({ blockId, events, properties, list, methods }) =>
|
||||
icon: 'PlusOutlined',
|
||||
...properties.addItemButton,
|
||||
}}
|
||||
methods={methods}
|
||||
onClick={() => methods.pushItem()}
|
||||
/>
|
||||
</div>
|
||||
@ -124,7 +122,6 @@ const ControlledListBlock = ({ blockId, events, properties, list, methods }) =>
|
||||
: {}),
|
||||
},
|
||||
}}
|
||||
methods={methods}
|
||||
onClick={() => methods.removeItem(i)}
|
||||
/>,
|
||||
]
|
||||
|
@ -50,7 +50,6 @@ const DateRangeSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -76,7 +75,6 @@ const DateRangeSelector = ({
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
properties={properties.suffixIcon || 'CalendarOutlined'}
|
||||
methods={methods}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ const DateSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -64,7 +63,6 @@ const DateSelector = ({
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
properties={properties.suffixIcon || 'CalendarOutlined'}
|
||||
methods={methods}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
import React from 'react';
|
||||
import { DatePicker } from 'antd';
|
||||
import moment from 'moment';
|
||||
import { get, type } from '@lowdefy/helpers';
|
||||
import { type } from '@lowdefy/helpers';
|
||||
import { blockDefaultProps } from '@lowdefy/block-tools';
|
||||
|
||||
import Label from '../Label/Label';
|
||||
@ -49,7 +49,6 @@ const DateTimeSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -71,7 +70,6 @@ const DateTimeSelector = ({
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
properties={properties.suffixIcon || 'CalendarOutlined'}
|
||||
methods={methods}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -32,17 +32,17 @@ const getDefaultMenu = (menus, menuId = 'default', links) => {
|
||||
const getTitle = (id, properties, defaultTitle) =>
|
||||
(properties && properties.title) || defaultTitle || id;
|
||||
|
||||
const MenuTitle = ({ id, methods, pageId, properties, url, linkStyle }) =>
|
||||
const MenuTitle = ({ id, makeCssClass, pageId, properties, url, linkStyle }) =>
|
||||
type.isString(pageId) ? (
|
||||
<Link to={`/${pageId}`} className={methods.makeCssClass([linkStyle])}>
|
||||
<Link to={`/${pageId}`} className={makeCssClass([linkStyle])}>
|
||||
{getTitle(id, properties, pageId)}
|
||||
</Link>
|
||||
) : type.isString(url) ? (
|
||||
<a href={url} className={methods.makeCssClass([linkStyle])}>
|
||||
<a href={url} className={makeCssClass([linkStyle])}>
|
||||
{getTitle(id, properties, url)}
|
||||
</a>
|
||||
) : (
|
||||
<span className={methods.makeCssClass([linkStyle])}>{getTitle(id, properties)}</span>
|
||||
<span className={makeCssClass([linkStyle])}>{getTitle(id, properties)}</span>
|
||||
);
|
||||
|
||||
const getNestedColors = (menuColor, background) => {
|
||||
@ -185,7 +185,7 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<MenuTitle
|
||||
linkStyle={link.style}
|
||||
id={link.id}
|
||||
methods={methods}
|
||||
makeCssClass={methods.makeCssClass}
|
||||
properties={link.properties}
|
||||
/>
|
||||
}
|
||||
@ -195,7 +195,6 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<Icon
|
||||
blockId={`${link.id}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={link.properties.icon}
|
||||
/>
|
||||
)
|
||||
@ -211,7 +210,7 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<MenuTitle
|
||||
linkStyle={subLink.style}
|
||||
id={subLink.id}
|
||||
methods={methods}
|
||||
makeCssClass={methods.makeCssClass}
|
||||
properties={subLink.properties}
|
||||
/>
|
||||
}
|
||||
@ -226,7 +225,6 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<Icon
|
||||
blockId={`${subLinkGroup.id}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={subLinkGroup.properties.icon}
|
||||
/>
|
||||
)
|
||||
@ -235,7 +233,7 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<MenuTitle
|
||||
linkStyle={subLinkGroup.style}
|
||||
id={subLinkGroup.id}
|
||||
methods={methods}
|
||||
makeCssClass={methods.makeCssClass}
|
||||
pageId={subLinkGroup.pageId}
|
||||
properties={subLinkGroup.properties}
|
||||
url={subLinkGroup.url}
|
||||
@ -256,7 +254,6 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<Icon
|
||||
blockId={`${subLink.id}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={subLink.properties.icon}
|
||||
/>
|
||||
)
|
||||
@ -265,7 +262,7 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<MenuTitle
|
||||
linkStyle={subLink.style}
|
||||
id={subLink.id}
|
||||
methods={methods}
|
||||
makeCssClass={methods.makeCssClass}
|
||||
pageId={subLink.pageId}
|
||||
properties={subLink.properties}
|
||||
url={subLink.url}
|
||||
@ -288,7 +285,6 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<Icon
|
||||
blockId={`${link.id}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={link.properties.icon}
|
||||
/>
|
||||
)
|
||||
@ -297,7 +293,7 @@ const MenuComp = ({ blockId, events, methods, menus, pageId, properties, rename
|
||||
<MenuTitle
|
||||
linkStyle={link.style}
|
||||
id={link.id}
|
||||
methods={methods}
|
||||
makeCssClass={methods.makeCssClass}
|
||||
pageId={link.pageId}
|
||||
properties={link.properties}
|
||||
url={link.url}
|
||||
|
@ -34,7 +34,6 @@ const MessageBlock = ({ blockId, events, properties, methods }) => {
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
properties={args.icon || properties.icon}
|
||||
methods={methods}
|
||||
/>
|
||||
),
|
||||
className: methods.makeCssClass(properties.messageStyle),
|
||||
|
@ -44,7 +44,6 @@ const MonthSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -65,7 +64,6 @@ const MonthSelector = ({
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
properties={properties.suffixIcon || 'CalendarOutlined'}
|
||||
methods={methods}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ const MultipleSelector = ({
|
||||
<Label
|
||||
blockId={blockId}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
properties={{ title: properties.title, size: properties.size, ...properties.label }}
|
||||
required={required}
|
||||
validation={validation}
|
||||
@ -61,7 +60,6 @@ const MultipleSelector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.suffixIcon}
|
||||
/>
|
||||
)
|
||||
@ -71,7 +69,6 @@ const MultipleSelector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_clearIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.clearIcon}
|
||||
/>
|
||||
)
|
||||
@ -81,7 +78,6 @@ const MultipleSelector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_selectedIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.selectedIcon}
|
||||
/>
|
||||
)
|
||||
|
@ -32,20 +32,20 @@ const NotificationBlock = ({ blockId, events, properties, methods }) => {
|
||||
blockId={`${blockId}_button`}
|
||||
events={events}
|
||||
properties={properties.button}
|
||||
methods={methods}
|
||||
onClick={() => methods.triggerEvent({ name: 'onClose' })}
|
||||
/>
|
||||
),
|
||||
className: methods.makeCssClass(properties.notificationStyle),
|
||||
description: args.description || properties.description,
|
||||
duration: type.isNone(args.duration) ? properties.duration : args.duration,
|
||||
icon: properties.icon && <Icon properties={properties.icon} methods={methods} />,
|
||||
icon: properties.icon && (
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
),
|
||||
closeIcon: properties.closeIcon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_closeIcon`}
|
||||
events={events}
|
||||
properties={properties.closeIcon}
|
||||
methods={methods}
|
||||
/>
|
||||
),
|
||||
message: args.message || properties.message || blockId,
|
||||
|
@ -37,7 +37,6 @@ const NumberInput = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<InputNumber
|
||||
|
@ -27,7 +27,6 @@ const PageHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -37,7 +36,6 @@ const PageHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
properties={properties.header}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.header(),
|
||||
}}
|
||||
@ -48,7 +46,6 @@ const PageHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
properties={properties.content}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.content(),
|
||||
}}
|
||||
@ -59,7 +56,6 @@ const PageHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
properties={properties.footer}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
}}
|
||||
|
@ -28,7 +28,6 @@ const PageHCSF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -38,7 +37,6 @@ const PageHCSF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
properties={properties.header}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.header(),
|
||||
}}
|
||||
@ -47,7 +45,6 @@ const PageHCSF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={`${blockId}_layout`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.main}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -57,7 +54,6 @@ const PageHCSF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
properties={properties.content}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.content(),
|
||||
}}
|
||||
@ -93,7 +89,6 @@ const PageHCSF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
properties={properties.footer}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
}}
|
||||
|
@ -28,7 +28,6 @@ const PageHSCF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -38,7 +37,6 @@ const PageHSCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
properties={properties.header}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.header(),
|
||||
}}
|
||||
@ -47,7 +45,6 @@ const PageHSCF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={`${blockId}_layout`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.main}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -78,7 +75,6 @@ const PageHSCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
properties={properties.content}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.content(),
|
||||
}}
|
||||
@ -93,7 +89,6 @@ const PageHSCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
properties={properties.footer}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
}}
|
||||
|
@ -100,7 +100,6 @@ const PageHeaderMenu = ({
|
||||
<Layout
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -108,7 +107,6 @@ const PageHeaderMenu = ({
|
||||
<Header
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([
|
||||
{
|
||||
style: styles.header,
|
||||
@ -178,7 +176,6 @@ const PageHeaderMenu = ({
|
||||
<Content
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([properties.content, { style: styles.body }])}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -192,6 +189,11 @@ const PageHeaderMenu = ({
|
||||
properties.breadcrumb,
|
||||
{ style: { padding: '16px 0' } },
|
||||
])}
|
||||
rename={{
|
||||
events: {
|
||||
onClick: 'onBreadcrumbClick',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<div className={methods.makeCssClass(styles.noBreadcrumb)} />
|
||||
@ -205,7 +207,6 @@ const PageHeaderMenu = ({
|
||||
<Footer
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.footer}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
|
@ -225,6 +225,10 @@
|
||||
"onToggleMenuGroup": {
|
||||
"type": "array",
|
||||
"description": "Trigger action when mobile menu group is opened."
|
||||
},
|
||||
"onBreadcrumbClick": {
|
||||
"type": "array",
|
||||
"description": "Trigger action when a breadcrumb item is clicked."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ const PageSHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -57,7 +56,6 @@ const PageSHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
<Layout
|
||||
blockId={`${blockId}_layout`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.main}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -67,7 +65,6 @@ const PageSHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
properties={properties.header}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.header(),
|
||||
}}
|
||||
@ -78,7 +75,6 @@ const PageSHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
properties={properties.content}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.content(),
|
||||
}}
|
||||
@ -89,7 +85,6 @@ const PageSHCF = ({ blockId, events, content, properties, methods }) => (
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
properties={properties.footer}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
}}
|
||||
|
@ -114,14 +114,12 @@ const PageSiderMenu = ({
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
properties={{ style: mergeObjects([{ minHeight: '100vh' }, properties.style]) }}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<>
|
||||
<Header
|
||||
blockId={`${blockId}_header`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([{ style: styles.header }, properties.header])}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -186,7 +184,6 @@ const PageSiderMenu = ({
|
||||
blockId={`${blockId}_layout`}
|
||||
events={events}
|
||||
properties={properties.layout}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<>
|
||||
@ -298,7 +295,6 @@ const PageSiderMenu = ({
|
||||
<Content
|
||||
blockId={`${blockId}_content`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([{ style: styles.body }, properties.content])}
|
||||
content={{
|
||||
content: () => (
|
||||
@ -312,6 +308,11 @@ const PageSiderMenu = ({
|
||||
{ style: { padding: '16px 0' } },
|
||||
properties.breadcrumb,
|
||||
])}
|
||||
rename={{
|
||||
events: {
|
||||
onClick: 'onBreadcrumbClick',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<div className={methods.makeCssClass(styles.noBreadcrumb)} />
|
||||
@ -321,7 +322,6 @@ const PageSiderMenu = ({
|
||||
<Footer
|
||||
blockId={`${blockId}_footer`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.footer}
|
||||
content={{
|
||||
content: () => content.footer(),
|
||||
|
@ -306,6 +306,14 @@
|
||||
"onToggleMenuGroup": {
|
||||
"type": "array",
|
||||
"description": "Trigger action when mobile menu group is opened."
|
||||
},
|
||||
"onBreadcrumbClick": {
|
||||
"type": "array",
|
||||
"description": "Trigger action when a breadcrumb item is clicked."
|
||||
},
|
||||
"onChangeToggleSiderAffix": {
|
||||
"type": "array",
|
||||
"description": "Trigger action when sider collapse button affix triggers a onChange event."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,14 +46,12 @@ const ParagraphBlock = ({ blockId, events, properties, methods }) => (
|
||||
key="copy-icon"
|
||||
events={events}
|
||||
blockId={`${blockId}_copyable_before_icon`}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[0]}
|
||||
/>,
|
||||
<Icon
|
||||
key="copied-icon"
|
||||
blockId={`${blockId}_copyable_after_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[1]}
|
||||
/>,
|
||||
]
|
||||
@ -61,7 +59,6 @@ const ParagraphBlock = ({ blockId, events, properties, methods }) => (
|
||||
<Icon
|
||||
blockId={`${blockId}_copyable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon}
|
||||
/>
|
||||
)),
|
||||
|
@ -61,14 +61,12 @@ const ParagraphInput = ({ blockId, events, properties, methods, value }) => {
|
||||
key="copy-icon"
|
||||
blockId={`${blockId}_copyable_before_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[0]}
|
||||
/>,
|
||||
<Icon
|
||||
key="copied-icon"
|
||||
blockId={`${blockId}_copyable_after_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[1]}
|
||||
/>,
|
||||
]
|
||||
@ -76,7 +74,6 @@ const ParagraphInput = ({ blockId, events, properties, methods, value }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_copyable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon}
|
||||
/>
|
||||
)),
|
||||
@ -114,7 +111,6 @@ const ParagraphInput = ({ blockId, events, properties, methods, value }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_editable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.editable.icon}
|
||||
/>
|
||||
),
|
||||
|
@ -44,7 +44,6 @@ const RadioSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<RadioGroup
|
||||
|
@ -102,7 +102,6 @@ const RatingSlider = ({
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
properties={{ title: properties.title, size: properties.size, ...properties.label }}
|
||||
required={required}
|
||||
validation={validation}
|
||||
@ -146,7 +145,6 @@ const RatingSlider = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_iconMin`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([
|
||||
{
|
||||
name: 'FrownOutlined',
|
||||
@ -213,7 +211,6 @@ const RatingSlider = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_iconMax`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([
|
||||
{
|
||||
name: 'SmileOutlined',
|
||||
|
@ -28,12 +28,7 @@ const ResultBlock = ({ blockId, events, content, methods, properties }) => (
|
||||
status={properties.status}
|
||||
icon={
|
||||
properties.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.icon}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={properties.icon} />
|
||||
)
|
||||
}
|
||||
extra={content.extra && content.extra({ justifyContent: 'center' })}
|
||||
|
@ -44,7 +44,6 @@ const Selector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -62,7 +61,6 @@ const Selector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.suffixIcon}
|
||||
/>
|
||||
)
|
||||
@ -72,7 +70,6 @@ const Selector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_clearIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.clearIcon}
|
||||
/>
|
||||
)
|
||||
|
@ -36,7 +36,6 @@ const StatisticBlock = ({ blockId, events, properties, methods }) => (
|
||||
<Icon
|
||||
blockId={`${blockId}_prefixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.prefixIcon}
|
||||
/>
|
||||
) : (
|
||||
@ -48,7 +47,6 @@ const StatisticBlock = ({ blockId, events, properties, methods }) => (
|
||||
<Icon
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.suffixIcon}
|
||||
/>
|
||||
) : (
|
||||
|
@ -45,7 +45,6 @@ const SwitchBlock = ({
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
properties={{ title: properties.title, size: properties.size, ...properties.label }}
|
||||
required={required}
|
||||
validation={validation}
|
||||
@ -71,7 +70,6 @@ const SwitchBlock = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_checkedIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{
|
||||
name: 'CheckOutlined',
|
||||
...(propertiesIconChecked || {}),
|
||||
@ -86,7 +84,6 @@ const SwitchBlock = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_uncheckedIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={{
|
||||
name: 'CloseOutlined',
|
||||
...(propertiesIconUnchecked || {}),
|
||||
|
@ -69,12 +69,7 @@ const TabsBlock = ({ blockId, events, content, methods, properties }) => {
|
||||
tab={
|
||||
<span className={methods.makeCssClass(tab.titleStyle)}>
|
||||
{tab.icon && (
|
||||
<Icon
|
||||
blockId={`${blockId}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={tab.icon}
|
||||
/>
|
||||
<Icon blockId={`${blockId}_icon`} events={events} properties={tab.icon} />
|
||||
)}
|
||||
{tab.title || tab.key}
|
||||
</span>
|
||||
|
@ -41,7 +41,6 @@ const TextAreaBlock = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => {
|
||||
const runAfterUpdate = useRunAfterUpdate();
|
||||
|
@ -37,7 +37,6 @@ const TextInput = ({
|
||||
blockId={blockId}
|
||||
events={events}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
properties={{ title: properties.title, size: properties.size, ...properties.label }}
|
||||
required={required}
|
||||
validation={validation}
|
||||
@ -70,7 +69,6 @@ const TextInput = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_prefixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.prefixIcon}
|
||||
/>
|
||||
))
|
||||
@ -81,7 +79,6 @@ const TextInput = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.suffixIcon}
|
||||
/>
|
||||
))
|
||||
|
@ -37,7 +37,6 @@ const TimelineList = ({ blockId, events, list, methods, properties, value }) =>
|
||||
<Icon
|
||||
blockId={`${blockId}_pendingDotIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([{ style: { fontSize: 16 } }, properties.pendingDotIcon])}
|
||||
/>
|
||||
)
|
||||
@ -66,7 +65,6 @@ const TimelineList = ({ blockId, events, list, methods, properties, value }) =>
|
||||
<Icon
|
||||
blockId={`${blockId}_${i}_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={mergeObjects([{ style, color }, icon])}
|
||||
/>
|
||||
)
|
||||
|
@ -50,14 +50,12 @@ const TitleBlock = ({ blockId, events, properties, methods }) => {
|
||||
key="copy-icon"
|
||||
blockId={`${blockId}_copyable_before_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[0]}
|
||||
/>,
|
||||
<Icon
|
||||
key="copied-icon"
|
||||
blockId={`${blockId}_copyable_after_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[1]}
|
||||
/>,
|
||||
]
|
||||
@ -65,7 +63,6 @@ const TitleBlock = ({ blockId, events, properties, methods }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_copyable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon}
|
||||
/>
|
||||
)),
|
||||
|
@ -64,14 +64,12 @@ const TitleInput = ({ blockId, events, properties, methods, value }) => {
|
||||
key="copy-icon"
|
||||
events={events}
|
||||
blockId={`${blockId}_copyable_before_icon`}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[0]}
|
||||
/>,
|
||||
<Icon
|
||||
key="copied-icon"
|
||||
events={events}
|
||||
blockId={`${blockId}_copyable_after_icon`}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon[1]}
|
||||
/>,
|
||||
]
|
||||
@ -79,7 +77,6 @@ const TitleInput = ({ blockId, events, properties, methods, value }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_copyable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.copyable.icon}
|
||||
/>
|
||||
)),
|
||||
@ -111,7 +108,6 @@ const TitleInput = ({ blockId, events, properties, methods, value }) => {
|
||||
<Icon
|
||||
blockId={`${blockId}_editable_icon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.editable.icon}
|
||||
/>
|
||||
),
|
||||
|
@ -44,7 +44,6 @@ const WeekSelector = ({
|
||||
validation={validation}
|
||||
required={required}
|
||||
loading={loading}
|
||||
methods={methods}
|
||||
content={{
|
||||
content: () => (
|
||||
<div className={methods.makeCssClass({ width: '100%' })}>
|
||||
@ -64,7 +63,6 @@ const WeekSelector = ({
|
||||
<Icon
|
||||
blockId={`${blockId}_suffixIcon`}
|
||||
events={events}
|
||||
methods={methods}
|
||||
properties={properties.suffixIcon || 'CalendarOutlined'}
|
||||
/>
|
||||
)
|
||||
|
@ -20,5 +20,19 @@ import Affix from '../src/blocks/Affix/Affix';
|
||||
import examples from '../demo/examples/Affix.yaml';
|
||||
import meta from '../src/blocks/Affix/Affix.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Affix, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Alert from '../src/blocks/Alert/Alert';
|
||||
import examples from '../demo/examples/Alert.yaml';
|
||||
import meta from '../src/blocks/Alert/Alert.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Alert, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,23 @@ import Anchor from '../src/blocks/Anchor/Anchor';
|
||||
import examples from '../demo/examples/Anchor.yaml';
|
||||
import meta from '../src/blocks/Anchor/Anchor.json';
|
||||
|
||||
runRenderTests({ examples, Block: Anchor, meta });
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({
|
||||
examples,
|
||||
Block: Anchor,
|
||||
meta,
|
||||
});
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,6 +21,20 @@ import AutoComplete from '../src/blocks/AutoComplete/AutoComplete';
|
||||
import examples from '../demo/examples/AutoComplete.yaml';
|
||||
import meta from '../src/blocks/AutoComplete/AutoComplete.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// FIX Jest: TypeError: parentInstance.children.indexOf is not a function
|
||||
// FIX Jest: TypeError: Cannot read property 'removeEventListener' of null
|
||||
runRenderTests({ examples, Block: AutoComplete, meta, validationsExamples });
|
||||
|
@ -20,5 +20,23 @@ import Avatar from '../src/blocks/Avatar/Avatar';
|
||||
import examples from '../demo/examples/Avatar.yaml';
|
||||
import meta from '../src/blocks/Avatar/Avatar.json';
|
||||
|
||||
runRenderTests({ examples, Block: Avatar, meta });
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({
|
||||
examples,
|
||||
Block: Avatar,
|
||||
meta,
|
||||
});
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,6 +20,20 @@ import Badge from '../src/blocks/Badge/Badge';
|
||||
import examples from '../demo/examples/Badge.yaml';
|
||||
import meta from '../src/blocks/Badge/Badge.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// FIX Jest: TypeError: Cannot read property 'add' of undefined
|
||||
// runRenderTests({ examples, Block: Badge, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Breadcrumb from '../src/blocks/Breadcrumb/Breadcrumb';
|
||||
import examples from '../demo/examples/Breadcrumb.yaml';
|
||||
import meta from '../src/blocks/Breadcrumb/Breadcrumb.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Breadcrumb, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Button from '../src/blocks/Button/Button';
|
||||
import examples from '../demo/examples/Button.yaml';
|
||||
import meta from '../src/blocks/Button/Button.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Button, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import ButtonSelector from '../src/blocks/ButtonSelector/ButtonSelector';
|
||||
import examples from '../demo/examples/ButtonSelector.yaml';
|
||||
import meta from '../src/blocks/ButtonSelector/ButtonSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: ButtonSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Card from '../src/blocks/Card/Card';
|
||||
import examples from '../demo/examples/Card.yaml';
|
||||
import meta from '../src/blocks/Card/Card.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Card, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import CheckboxSelector from '../src/blocks/CheckboxSelector/CheckboxSelector';
|
||||
import examples from '../demo/examples/CheckboxSelector.yaml';
|
||||
import meta from '../src/blocks/CheckboxSelector/CheckboxSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: CheckboxSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Collapse from '../src/blocks/Collapse/Collapse';
|
||||
import examples from '../demo/examples/Collapse.yaml';
|
||||
import meta from '../src/blocks/Collapse/Collapse.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Collapse, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Comment from '../src/blocks/Comment/Comment';
|
||||
import examples from '../demo/examples/Comment.yaml';
|
||||
import meta from '../src/blocks/Comment/Comment.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Comment, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -24,6 +24,20 @@ import ConfirmModal from '../src/blocks/ConfirmModal/ConfirmModal';
|
||||
import examples from '../demo/examples/ConfirmModal.yaml';
|
||||
import meta from '../src/blocks/ConfirmModal/ConfirmModal.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('antd/lib/modal', () => {
|
||||
return {
|
||||
confirm: jest.fn(),
|
||||
|
@ -20,5 +20,19 @@ import Content from '../src/blocks/Content/Content';
|
||||
import examples from '../demo/examples/Content.yaml';
|
||||
import meta from '../src/blocks/Content/Content.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Content, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import ControlledList from '../src/blocks/ControlledList/ControlledList';
|
||||
import examples from '../demo/examples/ControlledList.yaml';
|
||||
import meta from '../src/blocks/ControlledList/ControlledList.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: ControlledList, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import DateRangeSelector from '../src/blocks/DateRangeSelector/DateRangeSelector
|
||||
import examples from '../demo/examples/DateRangeSelector.yaml';
|
||||
import meta from '../src/blocks/DateRangeSelector/DateRangeSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: DateRangeSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import DateSelector from '../src/blocks/DateSelector/DateSelector';
|
||||
import examples from '../demo/examples/DateSelector.yaml';
|
||||
import meta from '../src/blocks/DateSelector/DateSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: DateSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import DateTimeSelector from '../src/blocks/DateTimeSelector/DateTimeSelector';
|
||||
import examples from '../demo/examples/DateTimeSelector.yaml';
|
||||
import meta from '../src/blocks/DateTimeSelector/DateTimeSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: DateTimeSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Descriptions from '../src/blocks/Descriptions/Descriptions';
|
||||
import examples from '../demo/examples/Descriptions.yaml';
|
||||
import meta from '../src/blocks/Descriptions/Descriptions.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Descriptions, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Divider from '../src/blocks/Divider/Divider';
|
||||
import examples from '../demo/examples/Divider.yaml';
|
||||
import meta from '../src/blocks/Divider/Divider.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Divider, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -24,6 +24,20 @@ import DrawerBlock from '../src/blocks/Drawer/Drawer';
|
||||
import examples from '../demo/examples/Drawer.yaml';
|
||||
import meta from '../src/blocks/Drawer/Drawer.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('antd/lib/drawer', () => {
|
||||
return jest.fn(() => 'mocked');
|
||||
});
|
||||
|
@ -20,5 +20,19 @@ import Footer from '../src/blocks/Footer/Footer';
|
||||
import examples from '../demo/examples/Footer.yaml';
|
||||
import meta from '../src/blocks/Footer/Footer.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Footer, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Header from '../src/blocks/Header/Header';
|
||||
import examples from '../demo/examples/Header.yaml';
|
||||
import meta from '../src/blocks/Header/Header.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Header, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,18 @@ import Icon from '../src/blocks/Icon/Icon';
|
||||
import examples from '../demo/examples/Icon.yaml';
|
||||
import meta from '../src/blocks/Icon/Icon.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
runRenderTests({ examples, Block: Icon, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import Label from '../src/blocks/Label/Label';
|
||||
import examples from '../demo/examples/Label.yaml';
|
||||
import meta from '../src/blocks/Label/Label.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Label, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Layout from '../src/blocks/Layout/Layout';
|
||||
import examples from '../demo/examples/Layout.yaml';
|
||||
import meta from '../src/blocks/Layout/Layout.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Layout, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Menu from '../src/blocks/Menu/Menu';
|
||||
import examples from '../demo/examples/Menu.yaml';
|
||||
import meta from '../src/blocks/Menu/Menu.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: (style, op) => JSON.stringify({ style, options: op }),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Menu, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -24,6 +24,20 @@ import Message from '../src/blocks/Message/Message';
|
||||
import examples from '../demo/examples/Message.yaml';
|
||||
import meta from '../src/blocks/Message/Message.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('antd/lib/message', () => {
|
||||
return {
|
||||
error: jest.fn(),
|
||||
|
@ -20,5 +20,19 @@ import MobileMenu from '../src/blocks/MobileMenu/MobileMenu';
|
||||
import examples from '../demo/examples/MobileMenu.yaml';
|
||||
import meta from '../src/blocks/MobileMenu/MobileMenu.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: MobileMenu, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -24,6 +24,20 @@ import ModalBlock from '../src/blocks/Modal/Modal';
|
||||
import examples from '../demo/examples/Modal.yaml';
|
||||
import meta from '../src/blocks/Modal/Modal.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('antd/lib/modal', () => {
|
||||
return jest.fn(() => 'mocked');
|
||||
});
|
||||
|
@ -21,5 +21,19 @@ import MonthSelector from '../src/blocks/MonthSelector/MonthSelector';
|
||||
import examples from '../demo/examples/MonthSelector.yaml';
|
||||
import meta from '../src/blocks/MonthSelector/MonthSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: MonthSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,6 +21,20 @@ import MultipleSelector from '../src/blocks/MultipleSelector/MultipleSelector';
|
||||
import examples from '../demo/examples/MultipleSelector.yaml';
|
||||
import meta from '../src/blocks/MultipleSelector/MultipleSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// FIX Jest: TypeError: Cannot read property 'scrollWidth' of null
|
||||
// runRenderTests({ examples, Block: MultipleSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -24,6 +24,20 @@ import Notification from '../src/blocks/Notification/Notification';
|
||||
import examples from '../demo/examples/Notification.yaml';
|
||||
import meta from '../src/blocks/Notification/Notification.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('antd/lib/notification', () => {
|
||||
return {
|
||||
error: jest.fn(),
|
||||
|
@ -21,5 +21,19 @@ import NumberInput from '../src/blocks/NumberInput/NumberInput';
|
||||
import examples from '../demo/examples/NumberInput.yaml';
|
||||
import meta from '../src/blocks/NumberInput/NumberInput.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: NumberInput, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import PageHCF from '../src/blocks/PageHCF/PageHCF';
|
||||
import examples from '../demo/examples/PageHCF.yaml';
|
||||
import meta from '../src/blocks/PageHCF/PageHCF.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: PageHCF, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import PageHCSF from '../src/blocks/PageHCSF/PageHCSF';
|
||||
import examples from '../demo/examples/PageHCSF.yaml';
|
||||
import meta from '../src/blocks/PageHCSF/PageHCSF.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: PageHCSF, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import PageHSCF from '../src/blocks/PageHSCF/PageHSCF';
|
||||
import examples from '../demo/examples/PageHSCF.yaml';
|
||||
import meta from '../src/blocks/PageHSCF/PageHSCF.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: PageHSCF, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,6 +20,20 @@ import PageHeaderMenu from '../src/blocks/PageHeaderMenu/PageHeaderMenu';
|
||||
import examples from '../demo/examples/PageHeaderMenu.yaml';
|
||||
import meta from '../src/blocks/PageHeaderMenu/PageHeaderMenu.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// FIX: TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
|
||||
// due to inline menu
|
||||
// runRenderTests({ examples, Block: PageHeaderMenu, meta });
|
||||
|
@ -20,5 +20,19 @@ import PageSHCF from '../src/blocks/PageSHCF/PageSHCF';
|
||||
import examples from '../demo/examples/PageSHCF.yaml';
|
||||
import meta from '../src/blocks/PageSHCF/PageSHCF.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: PageSHCF, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import PageSiderMenu from '../src/blocks/PageSiderMenu/PageSiderMenu';
|
||||
import examples from '../demo/examples/PageSiderMenu.yaml';
|
||||
import meta from '../src/blocks/PageSiderMenu/PageSiderMenu.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: PageSiderMenu, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Pagination from '../src/blocks/Pagination/Pagination';
|
||||
import examples from '../demo/examples/Pagination.yaml';
|
||||
import meta from '../src/blocks/Pagination/Pagination.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Pagination, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Paragraph from '../src/blocks/Paragraph/Paragraph';
|
||||
import examples from '../demo/examples/Paragraph.yaml';
|
||||
import meta from '../src/blocks/Paragraph/Paragraph.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Paragraph, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import ParagraphInput from '../src/blocks/ParagraphInput/ParagraphInput';
|
||||
import examples from '../demo/examples/ParagraphInput.yaml';
|
||||
import meta from '../src/blocks/ParagraphInput/ParagraphInput.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: ParagraphInput, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -19,5 +19,19 @@ import ProgressBlock from '../src/blocks/Progress/Progress';
|
||||
import examples from '../demo/examples/Progress.yaml';
|
||||
import meta from '../src/blocks/Progress/Progress.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: ProgressBlock, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import RadioSelector from '../src/blocks/RadioSelector/RadioSelector';
|
||||
import examples from '../demo/examples/RadioSelector.yaml';
|
||||
import meta from '../src/blocks/RadioSelector/RadioSelector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: RadioSelector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,6 +21,20 @@ import RatingSlider from '../src/blocks/RatingSlider/RatingSlider';
|
||||
import examples from '../demo/examples/RatingSlider.yaml';
|
||||
import meta from '../src/blocks/RatingSlider/RatingSlider.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// FIX: for properties.autoFocus - TypeError: Cannot read property 'focus' of null
|
||||
runRenderTests({ examples, Block: RatingSlider, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Result from '../src/blocks/Result/Result';
|
||||
import examples from '../demo/examples/Result.yaml';
|
||||
import meta from '../src/blocks/Result/Result.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Result, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import S3UploadButton from '../src/blocks/S3UploadButton/S3UploadButton';
|
||||
import examples from '../demo/examples/S3UploadButton.yaml';
|
||||
import meta from '../src/blocks/S3UploadButton/S3UploadButton.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: S3UploadButton, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -21,5 +21,19 @@ import Selector from '../src/blocks/Selector/Selector';
|
||||
import examples from '../demo/examples/Selector.yaml';
|
||||
import meta from '../src/blocks/Selector/Selector.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Selector, meta, validationsExamples });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Sider from '../src/blocks/Sider/Sider';
|
||||
import examples from '../demo/examples/Sider.yaml';
|
||||
import meta from '../src/blocks/Sider/Sider.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Sider, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Skeleton from '../src/blocks/Skeleton/Skeleton';
|
||||
import examples from '../demo/examples/Skeleton.yaml';
|
||||
import meta from '../src/blocks/Skeleton/Skeleton.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Skeleton, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Spin from '../src/blocks/Spin/Spin';
|
||||
import examples from '../demo/examples/Spin.yaml';
|
||||
import meta from '../src/blocks/Spin/Spin.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Spin, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
@ -20,5 +20,19 @@ import Statistic from '../src/blocks/Statistic/Statistic';
|
||||
import examples from '../demo/examples/Statistic.yaml';
|
||||
import meta from '../src/blocks/Statistic/Statistic.json';
|
||||
|
||||
jest.mock('@lowdefy/block-tools', () => {
|
||||
const originalModule = jest.requireActual('@lowdefy/block-tools');
|
||||
return {
|
||||
...originalModule,
|
||||
blockDefaultProps: {
|
||||
...originalModule.blockDefaultProps,
|
||||
methods: {
|
||||
...originalModule.blockDefaultProps.methods,
|
||||
makeCssClass: jest.fn((style, op) => JSON.stringify({ style, options: op })),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
runRenderTests({ examples, Block: Statistic, meta });
|
||||
runBlockSchemaTests({ examples, meta });
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user