@builder.io/mitosis 0.0.56-1 → 0.0.56-4
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/src/__tests__/data/basic-for.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-for.raw.jsx +21 -0
- package/dist/src/__tests__/data/blocks/img-state.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/img-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/blocks/section-state.raw.d.ts +6 -0
- package/dist/src/__tests__/data/blocks/section-state.raw.jsx +17 -0
- package/dist/src/__tests__/data/context/component-with-context.lite.d.ts +3 -1
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +7 -2
- package/dist/src/__tests__/html.test.js +126 -0
- package/dist/src/__tests__/react.test.js +6 -0
- package/dist/src/__tests__/svelte.test.js +40 -6
- package/dist/src/__tests__/webcomponent.test.js +132 -0
- package/dist/src/generators/html.js +72 -56
- package/dist/src/generators/react.js +3 -1
- package/dist/src/generators/svelte.js +10 -2
- package/dist/src/generators/vue.js +2 -2
- package/dist/src/helpers/render-imports.d.ts +1 -1
- package/dist/src/parsers/jsx.js +11 -2
- package/dist/src/types/config.d.ts +7 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyBasicForComponent(): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function MyBasicForComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useState)({
|
|
6
|
+
name: 'PatrickJS',
|
|
7
|
+
names: ['Steve', 'PatrickJS'],
|
|
8
|
+
});
|
|
9
|
+
return (<div>
|
|
10
|
+
<mitosis_1.For each={state.names}>
|
|
11
|
+
{function (person) { return (<>
|
|
12
|
+
<input value={state.name} onChange={function (event) {
|
|
13
|
+
state.name = event.target.value + ' and ' + person;
|
|
14
|
+
}}/>
|
|
15
|
+
Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid,
|
|
16
|
+
or Liquid!
|
|
17
|
+
</>); }}
|
|
18
|
+
</mitosis_1.For>
|
|
19
|
+
</div>);
|
|
20
|
+
}
|
|
21
|
+
exports.default = MyBasicForComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ImgStateComponent(): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function ImgStateComponent() {
|
|
5
|
+
var state = (0, mitosis_1.useState)({
|
|
6
|
+
canShow: true,
|
|
7
|
+
images: ['http://example.com/qwik.png'],
|
|
8
|
+
});
|
|
9
|
+
return (<div>
|
|
10
|
+
<mitosis_1.For each={state.images}>
|
|
11
|
+
{function (item, itemIndex) { return (<>
|
|
12
|
+
<img class={'custom-class'} src={item} key={itemIndex}/>
|
|
13
|
+
</>); }}
|
|
14
|
+
</mitosis_1.For>
|
|
15
|
+
</div>);
|
|
16
|
+
}
|
|
17
|
+
exports.default = ImgStateComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
+
function SectionStateComponent(props) {
|
|
5
|
+
var state = (0, mitosis_1.useState)({
|
|
6
|
+
max: 42,
|
|
7
|
+
items: [42],
|
|
8
|
+
});
|
|
9
|
+
return (<mitosis_1.Show when={state.max}>
|
|
10
|
+
<mitosis_1.For each={state.items}>
|
|
11
|
+
{function (item) { return (<section {...props.attributes} style={{ maxWidth: item + state.max }}>
|
|
12
|
+
{props.children}
|
|
13
|
+
</section>); }}
|
|
14
|
+
</mitosis_1.For>
|
|
15
|
+
</mitosis_1.Show>);
|
|
16
|
+
}
|
|
17
|
+
exports.default = SectionStateComponent;
|
|
@@ -6,9 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
var _1_1 = __importDefault(require("@dummy/1"));
|
|
7
7
|
var _2_1 = __importDefault(require("@dummy/2"));
|
|
8
8
|
var mitosis_1 = require("@builder.io/mitosis");
|
|
9
|
-
function ComponentWithContext() {
|
|
9
|
+
function ComponentWithContext(props) {
|
|
10
10
|
var foo = (0, mitosis_1.useContext)(_1_1.default);
|
|
11
|
-
(0, mitosis_1.setContext)(_1_1.default, {
|
|
11
|
+
(0, mitosis_1.setContext)(_1_1.default, {
|
|
12
|
+
foo: 'bar',
|
|
13
|
+
content: function () {
|
|
14
|
+
return props.content;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
12
17
|
return (<_2_1.default.Provider value={{ bar: 'baz' }}>
|
|
13
18
|
<>{foo.value}</>
|
|
14
19
|
</_2_1.default.Provider>);
|
|
@@ -2,9 +2,135 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var html_1 = require("../generators/html");
|
|
4
4
|
var jsx_1 = require("../parsers/jsx");
|
|
5
|
+
var basic = require('./data/basic.raw');
|
|
6
|
+
var basicFor = require('./data/basic-for.raw');
|
|
7
|
+
var submitButtonBlock = require('./data/blocks/submit-button.raw');
|
|
8
|
+
var inputBlock = require('./data/blocks/input.raw');
|
|
9
|
+
var selectBlock = require('./data/blocks/select.raw');
|
|
10
|
+
// const formBlock = require('./data/blocks/form.raw');
|
|
11
|
+
var button = require('./data/blocks/button.raw');
|
|
12
|
+
var textarea = require('./data/blocks/textarea.raw');
|
|
13
|
+
var img = require('./data/blocks/img.raw');
|
|
14
|
+
var video = require('./data/blocks/video.raw');
|
|
15
|
+
var section = require('./data/blocks/section.raw');
|
|
16
|
+
var sectionState = require('./data/blocks/section-state.raw');
|
|
17
|
+
var text = require('./data/blocks/text.raw');
|
|
18
|
+
var image = require('./data/blocks/image.raw');
|
|
19
|
+
var imageState = require('./data/blocks/img-state.raw');
|
|
20
|
+
var columns = require('./data/blocks/columns.raw');
|
|
21
|
+
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
22
|
+
var onUpdateWithDeps = require('./data/blocks/onUpdateWithDeps.raw');
|
|
23
|
+
var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
24
|
+
var multipleOnUpdateWithDeps = require('./data/blocks/multiple-onUpdateWithDeps.raw');
|
|
25
|
+
var onMount = require('./data/blocks/onMount.raw');
|
|
5
26
|
var stamped = require('./data/blocks/stamped-io.raw');
|
|
6
27
|
var shadowDom = require('./data/blocks/shadow-dom.raw');
|
|
7
28
|
describe('Html', function () {
|
|
29
|
+
test('Basic', function () {
|
|
30
|
+
var component = (0, jsx_1.parseJsx)(basic);
|
|
31
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
32
|
+
expect(output).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('BasicFor', function () {
|
|
35
|
+
var component = (0, jsx_1.parseJsx)(basicFor);
|
|
36
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
37
|
+
expect(output).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
test('Input block', function () {
|
|
40
|
+
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
41
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
42
|
+
expect(output).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
test('Submit button block', function () {
|
|
45
|
+
var component = (0, jsx_1.parseJsx)(submitButtonBlock);
|
|
46
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
47
|
+
expect(output).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
test('Select block', function () {
|
|
50
|
+
var component = (0, jsx_1.parseJsx)(selectBlock);
|
|
51
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
52
|
+
expect(output).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
// test('Form block', () => {
|
|
55
|
+
// const component = parseJsx(formBlock);
|
|
56
|
+
// const output = componentToHtml()({ component });
|
|
57
|
+
// expect(output).toMatchSnapshot();
|
|
58
|
+
// });
|
|
59
|
+
test('Button', function () {
|
|
60
|
+
var component = (0, jsx_1.parseJsx)(button);
|
|
61
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
62
|
+
expect(output).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
test('Textarea', function () {
|
|
65
|
+
var component = (0, jsx_1.parseJsx)(textarea);
|
|
66
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
67
|
+
expect(output).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
test('Img', function () {
|
|
70
|
+
var component = (0, jsx_1.parseJsx)(img);
|
|
71
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
72
|
+
expect(output).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
test('ImageState', function () {
|
|
75
|
+
var component = (0, jsx_1.parseJsx)(imageState);
|
|
76
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
77
|
+
expect(output).toMatchSnapshot();
|
|
78
|
+
});
|
|
79
|
+
test('Video', function () {
|
|
80
|
+
var component = (0, jsx_1.parseJsx)(video);
|
|
81
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
82
|
+
expect(output).toMatchSnapshot();
|
|
83
|
+
});
|
|
84
|
+
test('Section', function () {
|
|
85
|
+
var component = (0, jsx_1.parseJsx)(section);
|
|
86
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
87
|
+
expect(output).toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
test('SectionState', function () {
|
|
90
|
+
var component = (0, jsx_1.parseJsx)(sectionState);
|
|
91
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
92
|
+
expect(output).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
test('Text', function () {
|
|
95
|
+
var component = (0, jsx_1.parseJsx)(text);
|
|
96
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
97
|
+
expect(output).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
test('Image', function () {
|
|
100
|
+
var component = (0, jsx_1.parseJsx)(image);
|
|
101
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
102
|
+
expect(output).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
test('Columns', function () {
|
|
105
|
+
var component = (0, jsx_1.parseJsx)(columns);
|
|
106
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
107
|
+
expect(output).toMatchSnapshot();
|
|
108
|
+
});
|
|
109
|
+
test('onUpdate', function () {
|
|
110
|
+
var component = (0, jsx_1.parseJsx)(onUpdate);
|
|
111
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
112
|
+
expect(output).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
test('onUpdateWithDeps', function () {
|
|
115
|
+
var component = (0, jsx_1.parseJsx)(onUpdateWithDeps);
|
|
116
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
117
|
+
expect(output).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
test('multipleOnUpdate', function () {
|
|
120
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
|
|
121
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
122
|
+
expect(output).toMatchSnapshot();
|
|
123
|
+
});
|
|
124
|
+
test('multipleOnnUpdateWithDeps', function () {
|
|
125
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdateWithDeps);
|
|
126
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
127
|
+
expect(output).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
test('onMount & onUnMount', function () {
|
|
130
|
+
var component = (0, jsx_1.parseJsx)(onMount);
|
|
131
|
+
var output = (0, html_1.componentToHtml)()({ component: component });
|
|
132
|
+
expect(output).toMatchSnapshot();
|
|
133
|
+
});
|
|
8
134
|
test('Stamped', function () {
|
|
9
135
|
var component = (0, jsx_1.parseJsx)(stamped);
|
|
10
136
|
var html = (0, html_1.componentToHtml)()({ component: component });
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var react_1 = require("../generators/react");
|
|
4
4
|
var jsx_1 = require("../parsers/jsx");
|
|
5
5
|
var basic = require('./data/basic.raw');
|
|
6
|
+
var basicFor = require('./data/basic-for.raw');
|
|
6
7
|
var submitButtonBlock = require('./data/blocks/submit-button.raw');
|
|
7
8
|
var inputBlock = require('./data/blocks/input.raw');
|
|
8
9
|
var selectBlock = require('./data/blocks/select.raw');
|
|
@@ -31,6 +32,11 @@ describe('React', function () {
|
|
|
31
32
|
var output = (0, react_1.componentToReact)()({ component: component });
|
|
32
33
|
expect(output).toMatchSnapshot();
|
|
33
34
|
});
|
|
35
|
+
test('BasicFor', function () {
|
|
36
|
+
var component = (0, jsx_1.parseJsx)(basicFor);
|
|
37
|
+
var output = (0, react_1.componentToReact)()({ component: component });
|
|
38
|
+
expect(output).toMatchSnapshot();
|
|
39
|
+
});
|
|
34
40
|
test('Input block', function () {
|
|
35
41
|
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
36
42
|
var output = (0, react_1.componentToReact)()({ component: component });
|
|
@@ -1,36 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var svelte_1 = require("../generators/svelte");
|
|
3
|
+
var svelte_1 = require("../generators/context/svelte");
|
|
4
|
+
var context_1 = require("../parsers/context");
|
|
5
|
+
var svelte_2 = require("../generators/svelte");
|
|
4
6
|
var jsx_1 = require("../parsers/jsx");
|
|
5
7
|
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
6
8
|
var multipleOUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
7
9
|
var selfReferencingComponent = require('./data/blocks/self-referencing-component.raw');
|
|
8
10
|
var selfReferencingComponentWithChildren = require('./data/blocks/self-referencing-component-with-children.raw');
|
|
9
11
|
var builderRenderBlock = require('./data/blocks/builder-render-block.raw');
|
|
12
|
+
var rootShow = require('./data/blocks/rootShow.raw');
|
|
13
|
+
var simpleExample = require('./data/context/simple.context.lite');
|
|
14
|
+
var componentWithContext = require('./data/context/component-with-context.lite');
|
|
15
|
+
var renderBlock = require('./data/blocks/builder-render-block.raw');
|
|
10
16
|
describe('Svelte', function () {
|
|
11
17
|
test('onUpdate', function () {
|
|
12
18
|
var component = (0, jsx_1.parseJsx)(onUpdate);
|
|
13
|
-
var output = (0,
|
|
19
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
14
20
|
expect(output).toMatchSnapshot();
|
|
15
21
|
});
|
|
16
22
|
test('multipleOnUpdate', function () {
|
|
17
23
|
var component = (0, jsx_1.parseJsx)(multipleOUpdate);
|
|
18
|
-
var output = (0,
|
|
24
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
19
25
|
expect(output).toMatchSnapshot();
|
|
20
26
|
});
|
|
21
27
|
test('selfReferencingComponent', function () {
|
|
22
28
|
var component = (0, jsx_1.parseJsx)(selfReferencingComponent);
|
|
23
|
-
var output = (0,
|
|
29
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
24
30
|
expect(output).toMatchSnapshot();
|
|
25
31
|
});
|
|
26
32
|
test('selfReferencingComponentWithChildren', function () {
|
|
27
33
|
var component = (0, jsx_1.parseJsx)(selfReferencingComponentWithChildren);
|
|
28
|
-
var output = (0,
|
|
34
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
29
35
|
expect(output).toMatchSnapshot();
|
|
30
36
|
});
|
|
31
37
|
test('BuilderRenderBlock', function () {
|
|
32
38
|
var component = (0, jsx_1.parseJsx)(builderRenderBlock);
|
|
33
|
-
var output = (0,
|
|
39
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
34
40
|
expect(output).toMatchSnapshot();
|
|
35
41
|
});
|
|
42
|
+
test('rootShow', function () {
|
|
43
|
+
var component = (0, jsx_1.parseJsx)(rootShow);
|
|
44
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
45
|
+
expect(output).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
describe('Context', function () {
|
|
48
|
+
test('Parse context', function () {
|
|
49
|
+
var component = (0, context_1.parseContext)(simpleExample, { name: 'SimpleExample' });
|
|
50
|
+
if (!component) {
|
|
51
|
+
throw new Error('No parseable context found for simple.context.lite.ts');
|
|
52
|
+
}
|
|
53
|
+
expect(component).toMatchSnapshot();
|
|
54
|
+
var context = (0, svelte_1.contextToSvelte)()({ context: component });
|
|
55
|
+
expect(context).toMatchSnapshot();
|
|
56
|
+
});
|
|
57
|
+
test('Use and set context in components', function () {
|
|
58
|
+
var component = (0, jsx_1.parseJsx)(componentWithContext);
|
|
59
|
+
expect(component).toMatchSnapshot();
|
|
60
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
61
|
+
expect(output).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
test('Use and set context in complex components', function () {
|
|
64
|
+
var component = (0, jsx_1.parseJsx)(renderBlock);
|
|
65
|
+
expect(component).toMatchSnapshot();
|
|
66
|
+
var output = (0, svelte_2.componentToSvelte)()({ component: component });
|
|
67
|
+
expect(output).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
36
70
|
});
|
|
@@ -2,11 +2,143 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var html_1 = require("../generators/html");
|
|
4
4
|
var jsx_1 = require("../parsers/jsx");
|
|
5
|
+
var basic = require('./data/basic.raw');
|
|
6
|
+
var basicFor = require('./data/basic-for.raw');
|
|
7
|
+
var submitButtonBlock = require('./data/blocks/submit-button.raw');
|
|
8
|
+
var inputBlock = require('./data/blocks/input.raw');
|
|
9
|
+
var selectBlock = require('./data/blocks/select.raw');
|
|
10
|
+
// const formBlock = require('./data/blocks/form.raw');
|
|
11
|
+
var button = require('./data/blocks/button.raw');
|
|
12
|
+
var textarea = require('./data/blocks/textarea.raw');
|
|
13
|
+
var img = require('./data/blocks/img.raw');
|
|
14
|
+
var video = require('./data/blocks/video.raw');
|
|
15
|
+
var section = require('./data/blocks/section.raw');
|
|
16
|
+
var sectionState = require('./data/blocks/section-state.raw');
|
|
17
|
+
var text = require('./data/blocks/text.raw');
|
|
18
|
+
var image = require('./data/blocks/image.raw');
|
|
19
|
+
var imageState = require('./data/blocks/img-state.raw');
|
|
20
|
+
var columns = require('./data/blocks/columns.raw');
|
|
21
|
+
var onUpdate = require('./data/blocks/onUpdate.raw');
|
|
22
|
+
var onUpdateWithDeps = require('./data/blocks/onUpdateWithDeps.raw');
|
|
23
|
+
var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
|
|
24
|
+
var multipleOnUpdateWithDeps = require('./data/blocks/multiple-onUpdateWithDeps.raw');
|
|
25
|
+
var onMount = require('./data/blocks/onMount.raw');
|
|
5
26
|
var stamped = require('./data/blocks/stamped-io.raw');
|
|
27
|
+
var shadowDom = require('./data/blocks/shadow-dom.raw');
|
|
6
28
|
describe('webcomponent', function () {
|
|
29
|
+
test('Basic', function () {
|
|
30
|
+
var component = (0, jsx_1.parseJsx)(basic);
|
|
31
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
32
|
+
expect(output).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
test('BasicFor', function () {
|
|
35
|
+
var component = (0, jsx_1.parseJsx)(basicFor);
|
|
36
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
37
|
+
expect(output).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
test('Input block', function () {
|
|
40
|
+
var component = (0, jsx_1.parseJsx)(inputBlock);
|
|
41
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
42
|
+
expect(output).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
test('Submit button block', function () {
|
|
45
|
+
var component = (0, jsx_1.parseJsx)(submitButtonBlock);
|
|
46
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
47
|
+
expect(output).toMatchSnapshot();
|
|
48
|
+
});
|
|
49
|
+
test('Select block', function () {
|
|
50
|
+
var component = (0, jsx_1.parseJsx)(selectBlock);
|
|
51
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
52
|
+
expect(output).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
// test('Form block', () => {
|
|
55
|
+
// const component = parseJsx(formBlock);
|
|
56
|
+
// const output = componentToCustomElement()({ component });
|
|
57
|
+
// expect(output).toMatchSnapshot();
|
|
58
|
+
// });
|
|
59
|
+
test('Button', function () {
|
|
60
|
+
var component = (0, jsx_1.parseJsx)(button);
|
|
61
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
62
|
+
expect(output).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
test('Textarea', function () {
|
|
65
|
+
var component = (0, jsx_1.parseJsx)(textarea);
|
|
66
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
67
|
+
expect(output).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
test('Img', function () {
|
|
70
|
+
var component = (0, jsx_1.parseJsx)(img);
|
|
71
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
72
|
+
expect(output).toMatchSnapshot();
|
|
73
|
+
});
|
|
74
|
+
test('Video', function () {
|
|
75
|
+
var component = (0, jsx_1.parseJsx)(video);
|
|
76
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
77
|
+
expect(output).toMatchSnapshot();
|
|
78
|
+
});
|
|
79
|
+
test('Section', function () {
|
|
80
|
+
var component = (0, jsx_1.parseJsx)(section);
|
|
81
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
82
|
+
expect(output).toMatchSnapshot();
|
|
83
|
+
});
|
|
84
|
+
test('SectionState', function () {
|
|
85
|
+
var component = (0, jsx_1.parseJsx)(sectionState);
|
|
86
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
87
|
+
expect(output).toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
test('Text', function () {
|
|
90
|
+
var component = (0, jsx_1.parseJsx)(text);
|
|
91
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
92
|
+
expect(output).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
test('Image', function () {
|
|
95
|
+
var component = (0, jsx_1.parseJsx)(image);
|
|
96
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
97
|
+
expect(output).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
test('ImageState', function () {
|
|
100
|
+
var component = (0, jsx_1.parseJsx)(imageState);
|
|
101
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
102
|
+
expect(output).toMatchSnapshot();
|
|
103
|
+
});
|
|
104
|
+
test('Columns', function () {
|
|
105
|
+
var component = (0, jsx_1.parseJsx)(columns);
|
|
106
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
107
|
+
expect(output).toMatchSnapshot();
|
|
108
|
+
});
|
|
109
|
+
test('onUpdate', function () {
|
|
110
|
+
var component = (0, jsx_1.parseJsx)(onUpdate);
|
|
111
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
112
|
+
expect(output).toMatchSnapshot();
|
|
113
|
+
});
|
|
114
|
+
test('onUpdateWithDeps', function () {
|
|
115
|
+
var component = (0, jsx_1.parseJsx)(onUpdateWithDeps);
|
|
116
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
117
|
+
expect(output).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
test('multipleOnUpdate', function () {
|
|
120
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
|
|
121
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
122
|
+
expect(output).toMatchSnapshot();
|
|
123
|
+
});
|
|
124
|
+
test('multipleOnnUpdateWithDeps', function () {
|
|
125
|
+
var component = (0, jsx_1.parseJsx)(multipleOnUpdateWithDeps);
|
|
126
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
127
|
+
expect(output).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
test('onMount & onUnMount', function () {
|
|
130
|
+
var component = (0, jsx_1.parseJsx)(onMount);
|
|
131
|
+
var output = (0, html_1.componentToCustomElement)()({ component: component });
|
|
132
|
+
expect(output).toMatchSnapshot();
|
|
133
|
+
});
|
|
7
134
|
test('Stamped', function () {
|
|
8
135
|
var component = (0, jsx_1.parseJsx)(stamped);
|
|
9
136
|
var html = (0, html_1.componentToCustomElement)()({ component: component });
|
|
10
137
|
expect(html).toMatchSnapshot();
|
|
11
138
|
});
|
|
139
|
+
test('Shadow DOM', function () {
|
|
140
|
+
var component = (0, jsx_1.parseJsx)(shadowDom);
|
|
141
|
+
var html = (0, html_1.componentToCustomElement)()({ component: component });
|
|
142
|
+
expect(html).toMatchSnapshot();
|
|
143
|
+
});
|
|
12
144
|
});
|