@lowdefy/block-dev 4.0.0-alpha.5 → 4.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockSchemaErrors.js +6 -63
- package/dist/mockBlock.js +3 -6
- package/dist/runMockMethodTests.js +24 -18
- package/dist/runMockRenderTests.js +32 -16
- package/dist/runRenderTests.js +31 -24
- package/dist/schemaTest.js +2 -4
- package/dist/stubBlockProps.js +34 -31
- package/package.json +12 -12
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
4
3
|
|
|
@@ -16,73 +15,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
16
15
|
*/ import React from 'react';
|
|
17
16
|
const BlockSchemaErrors = ({ schemaErrors })=>{
|
|
18
17
|
if (!schemaErrors || schemaErrors.length === 0) return '';
|
|
19
|
-
return(/*#__PURE__*/
|
|
18
|
+
return(/*#__PURE__*/ React.createElement("div", {
|
|
20
19
|
style: {
|
|
21
20
|
padding: 10,
|
|
22
21
|
fontSize: '0.8rem',
|
|
23
22
|
border: '1px solid red',
|
|
24
23
|
background: '#fBB',
|
|
25
24
|
width: '100%'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
32
|
-
}),
|
|
33
|
-
schemaErrors.map((error, i)=>/*#__PURE__*/ _jsxs("div", {
|
|
34
|
-
children: [
|
|
35
|
-
/*#__PURE__*/ _jsx("br", {
|
|
36
|
-
}),
|
|
37
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
38
|
-
children: [
|
|
39
|
-
/*#__PURE__*/ _jsx("b", {
|
|
40
|
-
children: "keyword:"
|
|
41
|
-
}),
|
|
42
|
-
" ",
|
|
43
|
-
error.keyword
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
47
|
-
children: [
|
|
48
|
-
/*#__PURE__*/ _jsx("b", {
|
|
49
|
-
children: "message:"
|
|
50
|
-
}),
|
|
51
|
-
" ",
|
|
52
|
-
error.message
|
|
53
|
-
]
|
|
54
|
-
}),
|
|
55
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
56
|
-
children: [
|
|
57
|
-
/*#__PURE__*/ _jsx("b", {
|
|
58
|
-
children: "params:"
|
|
59
|
-
}),
|
|
60
|
-
" ",
|
|
61
|
-
JSON.stringify(error.params)
|
|
62
|
-
]
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
65
|
-
children: [
|
|
66
|
-
/*#__PURE__*/ _jsx("b", {
|
|
67
|
-
children: "dataPath:"
|
|
68
|
-
}),
|
|
69
|
-
" ",
|
|
70
|
-
error.dataPath
|
|
71
|
-
]
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
74
|
-
children: [
|
|
75
|
-
/*#__PURE__*/ _jsx("b", {
|
|
76
|
-
children: "schemaPath:"
|
|
77
|
-
}),
|
|
78
|
-
" ",
|
|
79
|
-
error.schemaPath
|
|
80
|
-
]
|
|
81
|
-
})
|
|
82
|
-
]
|
|
83
|
-
}, i)
|
|
84
|
-
)
|
|
85
|
-
]
|
|
86
|
-
}));
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "Schema Errors")), schemaErrors.map((error, i)=>/*#__PURE__*/ React.createElement("div", {
|
|
27
|
+
key: i
|
|
28
|
+
}, /*#__PURE__*/ React.createElement("br", null), /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "keyword:"), " ", error.keyword), /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "message:"), " ", error.message), /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "params:"), " ", JSON.stringify(error.params)), /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "dataPath:"), " ", error.dataPath), /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement("b", null, "schemaPath:"), " ", error.schemaPath))
|
|
29
|
+
)));
|
|
87
30
|
};
|
|
88
31
|
export default BlockSchemaErrors;
|
package/dist/mockBlock.js
CHANGED
|
@@ -75,15 +75,12 @@ const mockBlock = ({ meta , logger , schema })=>{
|
|
|
75
75
|
window.innerHeight = height || window.innerHeight;
|
|
76
76
|
window.dispatchEvent(new Event('resize'));
|
|
77
77
|
};
|
|
78
|
-
window.scrollTo = ()=>{
|
|
79
|
-
};
|
|
78
|
+
window.scrollTo = ()=>{};
|
|
80
79
|
// Fix css-animation or rc-motion deps on these
|
|
81
80
|
// https://github.com/react-component/motion/blob/9c04ef1a210a4f3246c9becba6e33ea945e00669/src/util/motion.ts#L27-L35
|
|
82
81
|
// https://github.com/yiminghe/css-animation/blob/a5986d73fd7dfce75665337f39b91483d63a4c8c/src/Event.js#L44
|
|
83
|
-
window.AnimationEvent = window.AnimationEvent || (()=>{
|
|
84
|
-
});
|
|
85
|
-
window.TransitionEvent = window.TransitionEvent || (()=>{
|
|
86
|
-
});
|
|
82
|
+
window.AnimationEvent = window.AnimationEvent || (()=>{});
|
|
83
|
+
window.TransitionEvent = window.TransitionEvent || (()=>{});
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
86
|
const getProps = (block)=>{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
4
3
|
|
|
@@ -18,6 +17,20 @@ import { type } from '@lowdefy/helpers';
|
|
|
18
17
|
import { render, screen } from '@testing-library/react';
|
|
19
18
|
import userEvent from '@testing-library/user-event';
|
|
20
19
|
import mockBlock from './mockBlock.js';
|
|
20
|
+
function _extends() {
|
|
21
|
+
_extends = Object.assign || function(target) {
|
|
22
|
+
for(var i = 1; i < arguments.length; i++){
|
|
23
|
+
var source = arguments[i];
|
|
24
|
+
for(var key in source){
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
26
|
+
target[key] = source[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
return _extends.apply(this, arguments);
|
|
33
|
+
}
|
|
21
34
|
const runMockMethodTests = ({ examples , logger , meta , mocks , schema , tests })=>{
|
|
22
35
|
const { before , methods , getProps } = mockBlock({
|
|
23
36
|
meta,
|
|
@@ -47,24 +60,17 @@ const runMockMethodTests = ({ examples , logger , meta , mocks , schema , tests
|
|
|
47
60
|
...methods,
|
|
48
61
|
registerMethod: props.methods.registerMethod
|
|
49
62
|
};
|
|
50
|
-
return(/*#__PURE__*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
props.methods[method.name](method.args);
|
|
60
|
-
},
|
|
61
|
-
"data-testid": "btn_method"
|
|
62
|
-
})
|
|
63
|
-
]
|
|
64
|
-
}));
|
|
63
|
+
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Block, _extends({}, props, {
|
|
64
|
+
value: value
|
|
65
|
+
})), /*#__PURE__*/ React.createElement("button", {
|
|
66
|
+
id: `${ex.id}_button`,
|
|
67
|
+
onClick: ()=>{
|
|
68
|
+
props.methods[method.name](method.args);
|
|
69
|
+
},
|
|
70
|
+
"data-testid": "btn_method"
|
|
71
|
+
})));
|
|
65
72
|
};
|
|
66
|
-
const { container } = render(/*#__PURE__*/
|
|
67
|
-
}));
|
|
73
|
+
const { container } = render(/*#__PURE__*/ React.createElement(Shell, null));
|
|
68
74
|
expect(container.firstChild).toMatchSnapshot();
|
|
69
75
|
userEvent.click(screen.getByTestId('btn_method'));
|
|
70
76
|
mockFns.forEach((mockFn)=>{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
4
3
|
|
|
@@ -15,12 +14,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
14
|
limitations under the License.
|
|
16
15
|
*/ import React from 'react';
|
|
17
16
|
import { type } from '@lowdefy/helpers';
|
|
18
|
-
import { render } from '@testing-library/react';
|
|
17
|
+
import { render, waitFor } from '@testing-library/react';
|
|
19
18
|
import mockBlock from './mockBlock.js';
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
function _extends() {
|
|
20
|
+
_extends = Object.assign || function(target) {
|
|
21
|
+
for(var i = 1; i < arguments.length; i++){
|
|
22
|
+
var source = arguments[i];
|
|
23
|
+
for(var key in source){
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25
|
+
target[key] = source[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
return _extends.apply(this, arguments);
|
|
32
|
+
}
|
|
33
|
+
const runMockRenderTests = ({ Block: Block1 , examples , logger , mocks , reset =()=>null
|
|
34
|
+
, schema , testConfig , })=>{
|
|
22
35
|
const { before , getProps } = mockBlock({
|
|
23
|
-
meta,
|
|
36
|
+
meta: Block1.meta,
|
|
24
37
|
logger,
|
|
25
38
|
schema
|
|
26
39
|
});
|
|
@@ -36,13 +49,16 @@ const runMockRenderTests = ({ examples , logger , meta , mocks , reset =()=>null
|
|
|
36
49
|
makeCssClass.mockReset();
|
|
37
50
|
makeCssClass.mockImplementation(makeCssImp);
|
|
38
51
|
});
|
|
39
|
-
const values = meta.values ? [
|
|
40
|
-
type.enforceType(meta.valueType, null),
|
|
41
|
-
...meta.values
|
|
42
|
-
] : [
|
|
43
|
-
type.enforceType(meta.valueType, null)
|
|
44
|
-
];
|
|
45
52
|
examples.forEach((ex)=>{
|
|
53
|
+
const values = [
|
|
54
|
+
type.enforceType(Block1.meta.valueType, null)
|
|
55
|
+
];
|
|
56
|
+
if (!type.isNone(ex.value)) {
|
|
57
|
+
values.push(ex.value);
|
|
58
|
+
}
|
|
59
|
+
if (type.isArray(testConfig.values)) {
|
|
60
|
+
values.push(...testConfig.values);
|
|
61
|
+
}
|
|
46
62
|
values.forEach((value, v)=>{
|
|
47
63
|
mocks.forEach((mock)=>{
|
|
48
64
|
test(`Mock render - ${ex.id} - value[${v}] - ${mock.name}`, async ()=>{
|
|
@@ -50,17 +66,17 @@ const runMockRenderTests = ({ examples , logger , meta , mocks , reset =()=>null
|
|
|
50
66
|
const Block = await mock.getBlock();
|
|
51
67
|
const Shell = ()=>{
|
|
52
68
|
const props = getProps(ex);
|
|
53
|
-
return(/*#__PURE__*/
|
|
54
|
-
...props,
|
|
69
|
+
return(/*#__PURE__*/ React.createElement(Block, _extends({}, props, {
|
|
55
70
|
methods: {
|
|
56
71
|
...props.methods,
|
|
57
72
|
makeCssClass
|
|
58
73
|
},
|
|
59
74
|
value: value
|
|
60
|
-
}));
|
|
75
|
+
})));
|
|
61
76
|
};
|
|
62
|
-
render(/*#__PURE__*/
|
|
63
|
-
|
|
77
|
+
const { container } = render(/*#__PURE__*/ React.createElement(Shell, null));
|
|
78
|
+
await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
|
|
79
|
+
);
|
|
64
80
|
mockFns.forEach((mockFn)=>{
|
|
65
81
|
expect(mockFn.mock.calls).toMatchSnapshot();
|
|
66
82
|
});
|
package/dist/runRenderTests.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
4
3
|
|
|
@@ -17,10 +16,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
16
|
import { render, waitFor } from '@testing-library/react';
|
|
18
17
|
import { type } from '@lowdefy/helpers';
|
|
19
18
|
import mockBlock from './mockBlock.js';
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
function _extends() {
|
|
20
|
+
_extends = Object.assign || function(target) {
|
|
21
|
+
for(var i = 1; i < arguments.length; i++){
|
|
22
|
+
var source = arguments[i];
|
|
23
|
+
for(var key in source){
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25
|
+
target[key] = source[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
return _extends.apply(this, arguments);
|
|
32
|
+
}
|
|
33
|
+
const runRenderTests = ({ Block , examples , logger , reset =()=>null
|
|
34
|
+
, schema , testConfig , validationsExamples , })=>{
|
|
22
35
|
const { before , methods , getProps } = mockBlock({
|
|
23
|
-
meta,
|
|
36
|
+
meta: Block.meta,
|
|
24
37
|
logger,
|
|
25
38
|
schema
|
|
26
39
|
});
|
|
@@ -30,58 +43,52 @@ const runRenderTests = ({ Block , examples , logger , meta , reset =()=>null
|
|
|
30
43
|
});
|
|
31
44
|
examples.forEach((ex)=>{
|
|
32
45
|
const values = [
|
|
33
|
-
type.enforceType(meta.valueType, null)
|
|
46
|
+
type.enforceType(Block.meta.valueType, null)
|
|
34
47
|
];
|
|
35
48
|
if (!type.isNone(ex.value)) {
|
|
36
49
|
values.push(ex.value);
|
|
37
50
|
}
|
|
38
|
-
if (type.isArray(
|
|
39
|
-
values.push(...
|
|
51
|
+
if (type.isArray(testConfig.values)) {
|
|
52
|
+
values.push(...testConfig.values);
|
|
40
53
|
}
|
|
41
54
|
values.forEach((value, v)=>{
|
|
42
55
|
test(`Render ${ex.id} - value[${v}]`, async ()=>{
|
|
43
56
|
// create shell to setup react hooks with getProps before render;
|
|
44
|
-
const Shell = ()=>/*#__PURE__*/
|
|
45
|
-
...getProps(ex),
|
|
57
|
+
const Shell = ()=>/*#__PURE__*/ React.createElement(Block, _extends({}, getProps(ex), {
|
|
46
58
|
value: value,
|
|
47
59
|
methods: methods
|
|
48
|
-
})
|
|
60
|
+
}))
|
|
49
61
|
;
|
|
50
|
-
const { container } = render(/*#__PURE__*/
|
|
51
|
-
}));
|
|
62
|
+
const { container } = render(/*#__PURE__*/ React.createElement(Shell, null));
|
|
52
63
|
await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
|
|
53
64
|
);
|
|
54
65
|
});
|
|
55
|
-
if (
|
|
66
|
+
if (testConfig && testConfig.validation) {
|
|
56
67
|
(validationsExamples || []).map((validationEx)=>{
|
|
57
68
|
test(`Render validation.status = ${validationEx.status} ${ex.id} - value[${v}]`, async ()=>{
|
|
58
69
|
// create shell to setup react hooks with getProps before render;
|
|
59
|
-
const Shell = ()=>/*#__PURE__*/
|
|
60
|
-
...getProps(ex),
|
|
70
|
+
const Shell = ()=>/*#__PURE__*/ React.createElement(Block, _extends({}, getProps(ex), {
|
|
61
71
|
value: value,
|
|
62
72
|
methods: methods,
|
|
63
73
|
validation: validationEx
|
|
64
|
-
})
|
|
74
|
+
}))
|
|
65
75
|
;
|
|
66
|
-
const { container } = render(/*#__PURE__*/
|
|
67
|
-
}));
|
|
76
|
+
const { container } = render(/*#__PURE__*/ React.createElement(Shell, null));
|
|
68
77
|
await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
|
|
69
78
|
);
|
|
70
79
|
});
|
|
71
80
|
});
|
|
72
81
|
}
|
|
73
|
-
if (
|
|
82
|
+
if (testConfig && testConfig.required) {
|
|
74
83
|
test(`Render required = true ${ex.id} - value[${v}]`, async ()=>{
|
|
75
84
|
// create shell to setup react hooks with getProps before render;
|
|
76
|
-
const Shell = ()=>/*#__PURE__*/
|
|
77
|
-
...getProps(ex),
|
|
85
|
+
const Shell = ()=>/*#__PURE__*/ React.createElement(Block, _extends({}, getProps(ex), {
|
|
78
86
|
value: value,
|
|
79
87
|
methods: methods,
|
|
80
88
|
required: true
|
|
81
|
-
})
|
|
89
|
+
}))
|
|
82
90
|
;
|
|
83
|
-
const { container } = render(/*#__PURE__*/
|
|
84
|
-
}));
|
|
91
|
+
const { container } = render(/*#__PURE__*/ React.createElement(Shell, null));
|
|
85
92
|
await waitFor(()=>expect(container.firstChild).toMatchSnapshot()
|
|
86
93
|
);
|
|
87
94
|
});
|
package/dist/schemaTest.js
CHANGED
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
import AjvErrors from 'ajv-errors';
|
|
17
17
|
import { blockSchema } from '@lowdefy/block-utils';
|
|
18
18
|
const testSchemaProperties = {
|
|
19
|
-
value: {
|
|
20
|
-
},
|
|
19
|
+
value: {},
|
|
21
20
|
methods: {
|
|
22
21
|
type: 'object'
|
|
23
22
|
},
|
|
24
|
-
schemaErrors: {
|
|
25
|
-
},
|
|
23
|
+
schemaErrors: {},
|
|
26
24
|
eventLog: {
|
|
27
25
|
type: 'array'
|
|
28
26
|
},
|
package/dist/stubBlockProps.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
4
3
|
|
|
@@ -17,23 +16,33 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
16
|
import { type } from '@lowdefy/helpers';
|
|
18
17
|
import { makeCssClass, createIcon } from '@lowdefy/block-utils';
|
|
19
18
|
import schemaTest from './schemaTest.js';
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
function _extends() {
|
|
20
|
+
_extends = Object.assign || function(target) {
|
|
21
|
+
for(var i = 1; i < arguments.length; i++){
|
|
22
|
+
var source = arguments[i];
|
|
23
|
+
for(var key in source){
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25
|
+
target[key] = source[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
return _extends.apply(this, arguments);
|
|
32
|
+
}
|
|
33
|
+
const validate = {};
|
|
22
34
|
const Icons = {
|
|
23
|
-
AiIcon: (props)=>/*#__PURE__*/
|
|
24
|
-
...props,
|
|
35
|
+
AiIcon: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
|
|
25
36
|
"data-testid": "AiIcon"
|
|
26
|
-
})
|
|
37
|
+
}))
|
|
27
38
|
,
|
|
28
|
-
AiOutlineExclamationCircle: (props)=>/*#__PURE__*/
|
|
29
|
-
...props,
|
|
39
|
+
AiOutlineExclamationCircle: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
|
|
30
40
|
"data-testid": "AiOutlineExclamationCircle"
|
|
31
|
-
})
|
|
41
|
+
}))
|
|
32
42
|
,
|
|
33
|
-
AiOutlineLoading3Quarters: (props)=>/*#__PURE__*/
|
|
34
|
-
...props,
|
|
43
|
+
AiOutlineLoading3Quarters: (props)=>/*#__PURE__*/ React.createElement("svg", _extends({}, props, {
|
|
35
44
|
"data-testid": "AiOutlineLoading3Quarters"
|
|
36
|
-
})
|
|
45
|
+
}))
|
|
37
46
|
,
|
|
38
47
|
ErrorIcon: ()=>{
|
|
39
48
|
throw new Error('ErrorIcon');
|
|
@@ -60,22 +69,17 @@ const stubBlockProps = ({ block , meta , logger , initialValue , schema })=>{
|
|
|
60
69
|
// block defaults
|
|
61
70
|
block.blockId = block.id;
|
|
62
71
|
if (meta.category === 'list' || meta.category === 'container' || meta.category === 'context') {
|
|
63
|
-
if (!block.areas) block.areas = {
|
|
64
|
-
};
|
|
65
|
-
if (!block.areas.content) block.areas.content = {
|
|
66
|
-
};
|
|
72
|
+
if (!block.areas) block.areas = {};
|
|
73
|
+
if (!block.areas.content) block.areas.content = {};
|
|
67
74
|
if (block.blocks) block.areas.content.blocks = block.blocks;
|
|
68
75
|
}
|
|
69
|
-
block.events = block.events || {
|
|
70
|
-
};
|
|
76
|
+
block.events = block.events || {};
|
|
71
77
|
block.eventLog = [];
|
|
72
78
|
block.components = {
|
|
73
79
|
Icon: IconComponent,
|
|
74
|
-
Link: (props)=>/*#__PURE__*/
|
|
75
|
-
"data-testid": `link-${props.href}
|
|
76
|
-
|
|
77
|
-
children: props.children
|
|
78
|
-
})
|
|
80
|
+
Link: (props)=>/*#__PURE__*/ React.createElement("a", _extends({
|
|
81
|
+
"data-testid": `link-${props.href}`
|
|
82
|
+
}, props), props.children)
|
|
79
83
|
};
|
|
80
84
|
// mock default block methods
|
|
81
85
|
block.methods = {
|
|
@@ -95,13 +99,13 @@ const stubBlockProps = ({ block , meta , logger , initialValue , schema })=>{
|
|
|
95
99
|
block.list = [];
|
|
96
100
|
(block.areas.content.blocks || []).forEach((bl, i)=>{
|
|
97
101
|
block.list.push({
|
|
98
|
-
content: ()=>/*#__PURE__*/
|
|
102
|
+
content: ()=>/*#__PURE__*/ React.createElement("div", {
|
|
99
103
|
"data-testid": `list-${i}-${bl.id}`,
|
|
104
|
+
key: bl.id,
|
|
100
105
|
style: {
|
|
101
106
|
border: '1px solid red',
|
|
102
107
|
padding: 10
|
|
103
|
-
}
|
|
104
|
-
children: bl.id
|
|
108
|
+
}
|
|
105
109
|
}, bl.id)
|
|
106
110
|
});
|
|
107
111
|
});
|
|
@@ -120,16 +124,15 @@ const stubBlockProps = ({ block , meta , logger , initialValue , schema })=>{
|
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
if (meta.category === 'container') {
|
|
123
|
-
block.content = {
|
|
124
|
-
};
|
|
127
|
+
block.content = {};
|
|
125
128
|
Object.keys(block.areas).forEach((key)=>{
|
|
126
|
-
block.content[key] = ()=>/*#__PURE__*/
|
|
129
|
+
block.content[key] = ()=>/*#__PURE__*/ React.createElement("div", {
|
|
127
130
|
"data-testid": `area-${key}`,
|
|
131
|
+
key: key,
|
|
128
132
|
style: {
|
|
129
133
|
border: '1px solid red',
|
|
130
134
|
padding: 10
|
|
131
|
-
}
|
|
132
|
-
children: key
|
|
135
|
+
}
|
|
133
136
|
}, key)
|
|
134
137
|
;
|
|
135
138
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/block-dev",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"licence": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Block Development Tools",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"swc": "swc src --out-dir dist --config-file ../../../.swcrc --delete-dir-on-start"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@emotion/jest": "11.
|
|
41
|
-
"@lowdefy/block-utils": "4.0.0-alpha.
|
|
42
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
43
|
-
"@testing-library/dom": "8.
|
|
40
|
+
"@emotion/jest": "11.7.1",
|
|
41
|
+
"@lowdefy/block-utils": "4.0.0-alpha.8",
|
|
42
|
+
"@lowdefy/helpers": "4.0.0-alpha.8",
|
|
43
|
+
"@testing-library/dom": "8.11.3",
|
|
44
44
|
"@testing-library/react": "13.0.0-alpha.4",
|
|
45
45
|
"@testing-library/user-event": "14.0.0-alpha.14",
|
|
46
|
-
"ajv": "8.
|
|
46
|
+
"ajv": "8.9.0",
|
|
47
47
|
"ajv-errors": "3.0.0",
|
|
48
|
-
"jest": "27.
|
|
48
|
+
"jest": "27.5.1",
|
|
49
49
|
"jest-serializer-html": "7.1.0",
|
|
50
|
-
"react": "
|
|
51
|
-
"react-dom": "
|
|
50
|
+
"react": "17.0.2",
|
|
51
|
+
"react-dom": "17.0.2",
|
|
52
52
|
"yaml-loader": "0.6.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@swc/cli": "0.1.
|
|
56
|
-
"@swc/core": "1.2.
|
|
55
|
+
"@swc/cli": "0.1.55",
|
|
56
|
+
"@swc/core": "1.2.135"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
|
|
62
62
|
}
|