@mgdis/core-ui-helpers 1.2.1 → 1.3.0
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/angular/index.cjs +1 -1
- package/dist/angular/index.cjs.map +1 -1
- package/dist/angular/index.js +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/index.umd.js +1 -1
- package/dist/angular/index.umd.js.map +1 -1
- package/dist/locale/index.cjs +3 -1
- package/dist/locale/index.cjs.map +1 -1
- package/dist/locale/index.js +3 -1
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/index.umd.js +3 -1
- package/dist/locale/index.umd.js.map +1 -1
- package/dist/playwright/index.cjs +12 -5
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.js +12 -5
- package/dist/playwright/index.js.map +1 -1
- package/dist/playwright/index.umd.js +12 -5
- package/dist/playwright/index.umd.js.map +1 -1
- package/dist/stencil/index.cjs +33 -33
- package/dist/stencil/index.cjs.map +1 -1
- package/dist/stencil/index.js +33 -33
- package/dist/stencil/index.js.map +1 -1
- package/dist/stencil/index.umd.js +33 -33
- package/dist/stencil/index.umd.js.map +1 -1
- package/dist/storybook/index.cjs +9 -7
- package/dist/storybook/index.cjs.map +1 -1
- package/dist/storybook/index.js +9 -7
- package/dist/storybook/index.js.map +1 -1
- package/dist/storybook/index.umd.js +9 -7
- package/dist/storybook/index.umd.js.map +1 -1
- package/dist/tests/index.cjs +24 -9
- package/dist/tests/index.cjs.map +1 -1
- package/dist/tests/index.d.ts +2 -2
- package/dist/tests/index.js +24 -9
- package/dist/tests/index.js.map +1 -1
- package/dist/tests/index.umd.js +24 -9
- package/dist/tests/index.umd.js.map +1 -1
- package/dist/utils/index.cjs +14 -6
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +14 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.umd.js +14 -6
- package/dist/utils/index.umd.js.map +1 -1
- package/dist/vue/index.cjs +2 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +2 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.umd.js +2 -1
- package/dist/vue/index.umd.js.map +1 -1
- package/package.json +11 -8
- package/.turbo/turbo-build.log +0 -49
- package/CHANGELOG.md +0 -95
- package/json-doc.test.json +0 -264
- package/rollup.config.mjs +0 -61
- package/src/angular/index.spec.ts +0 -8
- package/src/angular/index.ts +0 -1
- package/src/angular/mg-angular-logger/index.ts +0 -1
- package/src/angular/mg-angular-logger/mg-angular-logger.conf.ts +0 -3
- package/src/angular/mg-angular-logger/mg-angular-logger.spec.ts +0 -40
- package/src/angular/mg-angular-logger/mg-angular-logger.ts +0 -23
- package/src/locale/index.spec.ts +0 -15
- package/src/locale/index.ts +0 -1
- package/src/locale/locale.spec.ts +0 -266
- package/src/locale/locale.ts +0 -193
- package/src/playwright/config/index.ts +0 -43
- package/src/playwright/index.spec.ts +0 -16
- package/src/playwright/index.ts +0 -4
- package/src/playwright/utils/__snapshots__/utils.spec.ts.snap +0 -48
- package/src/playwright/utils/index.ts +0 -1
- package/src/playwright/utils/utils.spec.ts +0 -43
- package/src/playwright/utils/utils.ts +0 -69
- package/src/stencil/ide/__snapshots__/cem.spec.ts.snap +0 -248
- package/src/stencil/ide/__snapshots__/ide.spec.ts.snap +0 -414
- package/src/stencil/ide/cem.spec.ts +0 -35
- package/src/stencil/ide/cem.ts +0 -96
- package/src/stencil/ide/ide.spec.ts +0 -29
- package/src/stencil/ide/ide.ts +0 -221
- package/src/stencil/ide/index.ts +0 -2
- package/src/stencil/index.spec.ts +0 -16
- package/src/stencil/index.ts +0 -2
- package/src/stencil/normalize-boolean-attributes/index.ts +0 -1
- package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.spec.ts +0 -63
- package/src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.ts +0 -40
- package/src/storybook/index.spec.ts +0 -19
- package/src/storybook/index.ts +0 -1
- package/src/storybook/stencil/__snapshots__/stencil.spec.ts.snap +0 -329
- package/src/storybook/stencil/index.ts +0 -1
- package/src/storybook/stencil/stencil-shim.d.ts +0 -1
- package/src/storybook/stencil/stencil.conf.ts +0 -4
- package/src/storybook/stencil/stencil.spec.ts +0 -146
- package/src/storybook/stencil/stencil.ts +0 -366
- package/src/tests/index.spec.ts +0 -14
- package/src/tests/index.ts +0 -1
- package/src/tests/unit/__snapshots__/unit.spec.ts.snap +0 -52
- package/src/tests/unit/index.ts +0 -1
- package/src/tests/unit/unit.conf.ts +0 -9
- package/src/tests/unit/unit.spec.ts +0 -164
- package/src/tests/unit/unit.ts +0 -306
- package/src/utils/attributes/class-list/class-list.spec.ts +0 -36
- package/src/utils/attributes/class-list/class-list.ts +0 -51
- package/src/utils/attributes/class-list/index.ts +0 -1
- package/src/utils/attributes/id/id.spec.ts +0 -51
- package/src/utils/attributes/id/id.ts +0 -46
- package/src/utils/attributes/id/index.ts +0 -1
- package/src/utils/attributes/index.ts +0 -3
- package/src/utils/attributes/to-kebab-case/index.ts +0 -1
- package/src/utils/attributes/to-kebab-case/to-kebab-case.spec.ts +0 -29
- package/src/utils/attributes/to-kebab-case/to-kebab-case.ts +0 -23
- package/src/utils/components/__snapshots__/components.spec.ts.snap +0 -313
- package/src/utils/components/components.conf.ts +0 -11
- package/src/utils/components/components.spec.ts +0 -192
- package/src/utils/components/components.ts +0 -138
- package/src/utils/components/index.ts +0 -2
- package/src/utils/date/date.spec.ts +0 -12
- package/src/utils/date/date.ts +0 -20
- package/src/utils/date/index.ts +0 -1
- package/src/utils/elements/elements.spec.ts +0 -17
- package/src/utils/elements/elements.ts +0 -16
- package/src/utils/elements/index.ts +0 -1
- package/src/utils/index.spec.ts +0 -84
- package/src/utils/index.ts +0 -8
- package/src/utils/number/index.ts +0 -1
- package/src/utils/number/number.spec.ts +0 -14
- package/src/utils/number/number.ts +0 -6
- package/src/utils/object/index.ts +0 -2
- package/src/utils/object/object.conf.ts +0 -4
- package/src/utils/object/object.spec.ts +0 -110
- package/src/utils/object/object.ts +0 -26
- package/src/utils/string/index.ts +0 -1
- package/src/utils/string/string.spec.ts +0 -47
- package/src/utils/string/string.ts +0 -38
- package/src/utils/windows/index.ts +0 -1
- package/src/utils/windows/windows.spec.ts +0 -65
- package/src/utils/windows/windows.ts +0 -50
- package/src/vue/index.spec.ts +0 -8
- package/src/vue/index.ts +0 -1
- package/src/vue/mg-model/index.ts +0 -1
- package/src/vue/mg-model/mg-model.conf.ts +0 -6
- package/src/vue/mg-model/mg-model.spec.ts +0 -50
- package/src/vue/mg-model/mg-model.ts +0 -50
- package/tsconfig.json +0 -17
- package/typedoc.json +0 -14
- package/vitest.config.mts +0 -13
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`stencil > StorybookPreview > extractArgTypes > Should extract arg types 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"": {
|
|
6
|
-
"description": "",
|
|
7
|
-
"name": "default",
|
|
8
|
-
"table": {
|
|
9
|
-
"category": "slots",
|
|
10
|
-
"type": {
|
|
11
|
-
"summary": undefined,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
"--custom-property": {
|
|
16
|
-
"description": "Custom property documentation",
|
|
17
|
-
"name": "--custom-property",
|
|
18
|
-
"table": {
|
|
19
|
-
"category": "custom properties",
|
|
20
|
-
"type": {
|
|
21
|
-
"summary": undefined,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
"arraytypes": {
|
|
26
|
-
"control": {
|
|
27
|
-
"type": "object",
|
|
28
|
-
},
|
|
29
|
-
"description": "docs",
|
|
30
|
-
"name": "arraytypes",
|
|
31
|
-
"options": undefined,
|
|
32
|
-
"table": {
|
|
33
|
-
"category": "props",
|
|
34
|
-
"defaultValue": {
|
|
35
|
-
"summary": undefined,
|
|
36
|
-
},
|
|
37
|
-
"type": {
|
|
38
|
-
"summary": "number[] | string[]",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
"type": {
|
|
42
|
-
"required": true,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
"attr": {
|
|
46
|
-
"control": {
|
|
47
|
-
"type": "text",
|
|
48
|
-
},
|
|
49
|
-
"description": "docs",
|
|
50
|
-
"name": "attr",
|
|
51
|
-
"options": undefined,
|
|
52
|
-
"table": {
|
|
53
|
-
"category": "props",
|
|
54
|
-
"defaultValue": {
|
|
55
|
-
"summary": undefined,
|
|
56
|
-
},
|
|
57
|
-
"type": {
|
|
58
|
-
"summary": "string",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
"type": {
|
|
62
|
-
"required": true,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
"boolean": {
|
|
66
|
-
"control": {
|
|
67
|
-
"type": "boolean",
|
|
68
|
-
},
|
|
69
|
-
"description": "docs",
|
|
70
|
-
"name": "boolean",
|
|
71
|
-
"options": undefined,
|
|
72
|
-
"table": {
|
|
73
|
-
"category": "props",
|
|
74
|
-
"defaultValue": {
|
|
75
|
-
"summary": "false",
|
|
76
|
-
},
|
|
77
|
-
"type": {
|
|
78
|
-
"summary": "boolean",
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
"type": {
|
|
82
|
-
"required": true,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
"event": {
|
|
86
|
-
"description": "docs",
|
|
87
|
-
"name": "event",
|
|
88
|
-
"table": {
|
|
89
|
-
"category": "events",
|
|
90
|
-
"type": {
|
|
91
|
-
"summary": "boolean",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
"method": {
|
|
96
|
-
"description": "docs",
|
|
97
|
-
"name": "method",
|
|
98
|
-
"table": {
|
|
99
|
-
"category": "methods",
|
|
100
|
-
"type": {
|
|
101
|
-
"summary": "",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
"multionetype": {
|
|
106
|
-
"control": {
|
|
107
|
-
"type": "object",
|
|
108
|
-
},
|
|
109
|
-
"description": "docs",
|
|
110
|
-
"name": "multionetype",
|
|
111
|
-
"options": undefined,
|
|
112
|
-
"table": {
|
|
113
|
-
"category": "props",
|
|
114
|
-
"defaultValue": {
|
|
115
|
-
"summary": undefined,
|
|
116
|
-
},
|
|
117
|
-
"type": {
|
|
118
|
-
"summary": "(string | number)[]",
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
"type": {
|
|
122
|
-
"required": true,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
"multitype": {
|
|
126
|
-
"control": {
|
|
127
|
-
"type": "select",
|
|
128
|
-
},
|
|
129
|
-
"description": "docs",
|
|
130
|
-
"name": "multitype",
|
|
131
|
-
"options": [
|
|
132
|
-
undefined,
|
|
133
|
-
"blu",
|
|
134
|
-
"bli",
|
|
135
|
-
],
|
|
136
|
-
"table": {
|
|
137
|
-
"category": "props",
|
|
138
|
-
"defaultValue": {
|
|
139
|
-
"summary": undefined,
|
|
140
|
-
},
|
|
141
|
-
"type": {
|
|
142
|
-
"summary": ""blu" | "bli"",
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
"type": {
|
|
146
|
-
"required": true,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
"multitypewithstring": {
|
|
150
|
-
"control": {
|
|
151
|
-
"type": "text",
|
|
152
|
-
},
|
|
153
|
-
"description": "docs",
|
|
154
|
-
"name": "multitypewithstring",
|
|
155
|
-
"options": undefined,
|
|
156
|
-
"table": {
|
|
157
|
-
"category": "props",
|
|
158
|
-
"defaultValue": {
|
|
159
|
-
"summary": undefined,
|
|
160
|
-
},
|
|
161
|
-
"type": {
|
|
162
|
-
"summary": "number | string",
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
"type": {
|
|
166
|
-
"required": true,
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
"my-second-comp": {
|
|
170
|
-
"description": "<a href="./?path=/docs/undefined">View Component Documentation</a>",
|
|
171
|
-
"name": "my-second-comp",
|
|
172
|
-
"table": {
|
|
173
|
-
"category": "depends on",
|
|
174
|
-
"type": {
|
|
175
|
-
"summary": undefined,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
"number": {
|
|
180
|
-
"control": {
|
|
181
|
-
"type": "number",
|
|
182
|
-
},
|
|
183
|
-
"description": "docs",
|
|
184
|
-
"name": "number",
|
|
185
|
-
"options": undefined,
|
|
186
|
-
"table": {
|
|
187
|
-
"category": "props",
|
|
188
|
-
"defaultValue": {
|
|
189
|
-
"summary": undefined,
|
|
190
|
-
},
|
|
191
|
-
"type": {
|
|
192
|
-
"summary": "number",
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
"type": {
|
|
196
|
-
"required": true,
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
"objecttype": {
|
|
200
|
-
"control": {
|
|
201
|
-
"type": "object",
|
|
202
|
-
},
|
|
203
|
-
"description": "docs",
|
|
204
|
-
"name": "objecttype",
|
|
205
|
-
"options": undefined,
|
|
206
|
-
"table": {
|
|
207
|
-
"category": "props",
|
|
208
|
-
"defaultValue": {
|
|
209
|
-
"summary": undefined,
|
|
210
|
-
},
|
|
211
|
-
"type": {
|
|
212
|
-
"summary": "{ type: string, value: "blu" | "bli" }",
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
"type": {
|
|
216
|
-
"required": true,
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
"prop": {
|
|
220
|
-
"control": {
|
|
221
|
-
"type": "text",
|
|
222
|
-
},
|
|
223
|
-
"description": "docs",
|
|
224
|
-
"name": "prop",
|
|
225
|
-
"options": undefined,
|
|
226
|
-
"table": {
|
|
227
|
-
"category": "props",
|
|
228
|
-
"defaultValue": {
|
|
229
|
-
"summary": undefined,
|
|
230
|
-
},
|
|
231
|
-
"type": {
|
|
232
|
-
"summary": "string",
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
"type": {
|
|
236
|
-
"required": true,
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
"title": {
|
|
240
|
-
"description": "",
|
|
241
|
-
"name": "title",
|
|
242
|
-
"table": {
|
|
243
|
-
"category": "slots",
|
|
244
|
-
"type": {
|
|
245
|
-
"summary": undefined,
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
}
|
|
250
|
-
`;
|
|
251
|
-
|
|
252
|
-
exports[`stencil > StorybookPreview > extractArgTypes > Should extract arg types 2`] = `
|
|
253
|
-
{
|
|
254
|
-
"my-comp": {
|
|
255
|
-
"description": "<a href="./?path=/docs/atoms-my-comp--docs">View Component Documentation</a>",
|
|
256
|
-
"name": "my-comp",
|
|
257
|
-
"table": {
|
|
258
|
-
"category": "used by",
|
|
259
|
-
"type": {
|
|
260
|
-
"summary": undefined,
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
}
|
|
265
|
-
`;
|
|
266
|
-
|
|
267
|
-
exports[`stencil > StorybookPreview > extractComponentDescription > Should extract component description 1`] = `""`;
|
|
268
|
-
|
|
269
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 1`] = `""`;
|
|
270
|
-
|
|
271
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 2`] = `""`;
|
|
272
|
-
|
|
273
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 3`] = `""`;
|
|
274
|
-
|
|
275
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 4`] = `"<mg-batman></mg-batman>"`;
|
|
276
|
-
|
|
277
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 5`] = `"<mg-batman></mg-batman>"`;
|
|
278
|
-
|
|
279
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 6`] = `
|
|
280
|
-
"<mg-batman
|
|
281
|
-
boolean
|
|
282
|
-
text="hello"
|
|
283
|
-
object="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
284
|
-
array="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
285
|
-
function="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
286
|
-
></mg-batman>"
|
|
287
|
-
`;
|
|
288
|
-
|
|
289
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 7`] = `"<mg-batman>joker is behind you</mg-batman>"`;
|
|
290
|
-
|
|
291
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 8`] = `
|
|
292
|
-
"<mg-batman
|
|
293
|
-
boolean
|
|
294
|
-
text="hello"
|
|
295
|
-
object="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
296
|
-
>
|
|
297
|
-
<baby-batman></baby-batman>
|
|
298
|
-
</mg-batman>"
|
|
299
|
-
`;
|
|
300
|
-
|
|
301
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 9`] = `"joker is behind you"`;
|
|
302
|
-
|
|
303
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 10`] = `
|
|
304
|
-
"<mg-batman
|
|
305
|
-
boolean
|
|
306
|
-
text="hello"
|
|
307
|
-
object="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
308
|
-
>joker is behind you</mg-batman>"
|
|
309
|
-
`;
|
|
310
|
-
|
|
311
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 11`] = `
|
|
312
|
-
"<mg-batman
|
|
313
|
-
boolean
|
|
314
|
-
text="hello"
|
|
315
|
-
object="⚠️ Property must be set through a script or a framework-specific syntax."
|
|
316
|
-
>
|
|
317
|
-
<baby-batman>joker is behind you</baby-batman>
|
|
318
|
-
</mg-batman>"
|
|
319
|
-
`;
|
|
320
|
-
|
|
321
|
-
exports[`stencil > getStoryHTML > Should render story code exemple 12`] = `
|
|
322
|
-
"<blu-blu
|
|
323
|
-
boolean
|
|
324
|
-
text="hello"
|
|
325
|
-
blu="blu bli bla blo"
|
|
326
|
-
number="42"
|
|
327
|
-
html-content="Help text with html <b>bold</b>, <em>italic</em>."
|
|
328
|
-
></blu-blu>"
|
|
329
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './stencil';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '@stencil/core/internal/client';
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test, vi } from 'vitest';
|
|
2
|
-
import { filterArgs, stencilWrapper, getStoryHTML, getStorybookUrl, StorybookPreview } from '.';
|
|
3
|
-
import { VNode } from '@stencil/core';
|
|
4
|
-
import jsonDocs from '../../../json-doc.test.json';
|
|
5
|
-
import { JsonDocs } from '@stencil/core/internal';
|
|
6
|
-
|
|
7
|
-
vi.mock('@stencil/core/internal/client', () => ({
|
|
8
|
-
renderVdom: vi.fn(),
|
|
9
|
-
}));
|
|
10
|
-
|
|
11
|
-
describe('stencil', () => {
|
|
12
|
-
describe('filterArgs', () => {
|
|
13
|
-
test('Should get renderable args, case filtred default args', () => {
|
|
14
|
-
const res = filterArgs({ name: 'batman', default: true }, { default: true });
|
|
15
|
-
expect(res).toEqual({ name: 'batman' });
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('Should get renderable args, case no default args', () => {
|
|
19
|
-
const res = filterArgs({ name: 'batman', default: true, slot: '' }, undefined, ['slot']);
|
|
20
|
-
expect(res).toEqual({ name: 'batman', default: true });
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test.each([undefined, ''])('Should get renderable args, case no default args', val => {
|
|
24
|
-
expect.assertions(1);
|
|
25
|
-
try {
|
|
26
|
-
filterArgs(val);
|
|
27
|
-
} catch (err) {
|
|
28
|
-
expect(err.message).toEqual("filterArgs - args isn't an object.");
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('stencilWrapper', () => {
|
|
34
|
-
test('should do nothing, case no host', () => {
|
|
35
|
-
const storyFn = vi.fn();
|
|
36
|
-
const res = stencilWrapper(storyFn, {});
|
|
37
|
-
expect(storyFn).not.toHaveBeenCalled();
|
|
38
|
-
expect(res).toEqual(undefined);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test.each([{}, { globals: { locale: 'fr' } }])('should render element from VDOM', args => {
|
|
42
|
-
const storyFn = vi.fn();
|
|
43
|
-
|
|
44
|
-
// insert storybook host div
|
|
45
|
-
const storybookRoot = document.createElement('div');
|
|
46
|
-
storybookRoot.setAttribute('lang', 'fr');
|
|
47
|
-
storybookRoot.setAttribute('id', 'storybook-root');
|
|
48
|
-
document.querySelector('body')?.appendChild(storybookRoot);
|
|
49
|
-
|
|
50
|
-
const res = stencilWrapper(storyFn, args);
|
|
51
|
-
expect(storyFn).toHaveBeenCalledWith(args);
|
|
52
|
-
expect(res).toEqual(undefined);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('getStoryHTML', () => {
|
|
57
|
-
test.each([
|
|
58
|
-
{},
|
|
59
|
-
{ $tag$: undefined, $attrs$: {}, $children$: null, $text$: null },
|
|
60
|
-
{ $tag$: undefined, $attrs$: null, $children$: null, $text$: null },
|
|
61
|
-
{ $tag$: 'mg-batman', $attrs$: null, $children$: null, $text$: null },
|
|
62
|
-
{ $tag$: 'mg-batman', $attrs$: {}, $children$: null, $text$: null },
|
|
63
|
-
{
|
|
64
|
-
$tag$: 'mg-batman',
|
|
65
|
-
$attrs$: { boolean: true, text: 'hello', object: {}, array: [], function: () => {}, null: null, undefined: undefined, blank: '', style: 'top:0' },
|
|
66
|
-
$children$: null,
|
|
67
|
-
$text$: null,
|
|
68
|
-
},
|
|
69
|
-
{ $tag$: 'mg-batman', $attrs$: { innerHTML: 'joker is behind you' }, $children$: null, $text$: null },
|
|
70
|
-
{
|
|
71
|
-
$tag$: 'mg-batman',
|
|
72
|
-
$attrs$: { boolean: true, text: 'hello', object: {} },
|
|
73
|
-
$children$: [{ $tag$: 'baby-batman', $attrs$: {}, $children$: null, $text$: null }],
|
|
74
|
-
$text$: null,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
$tag$: null,
|
|
78
|
-
$attrs$: null,
|
|
79
|
-
$children$: null,
|
|
80
|
-
$text$: 'joker is behind you',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
$tag$: 'mg-batman',
|
|
84
|
-
$attrs$: { boolean: true, text: 'hello', object: {} },
|
|
85
|
-
$children$: [{ $tag$: null, $attrs$: {}, $children$: null, $text$: 'joker is behind you' }],
|
|
86
|
-
$text$: null,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
$tag$: 'mg-batman',
|
|
90
|
-
$attrs$: { boolean: true, text: 'hello', object: {} },
|
|
91
|
-
$children$: [{ $tag$: 'baby-batman', $attrs$: {}, $children$: [{ $tag$: null, $attrs$: {}, $children$: null, $text$: 'joker is behind you' }], $text$: null }],
|
|
92
|
-
$text$: null,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
$tag$: 'blu-blu',
|
|
96
|
-
$attrs$: { 'boolean': true, 'false': false, 'text': 'hello', 'blu': 'blu bli bla blo', 'number': 42, 'html-content': 'Help text with html <b>bold</b>, <em>italic</em>.' },
|
|
97
|
-
$children$: null,
|
|
98
|
-
$text$: null,
|
|
99
|
-
},
|
|
100
|
-
])('Should render story code exemple', args => {
|
|
101
|
-
const res = getStoryHTML(args as unknown as VNode);
|
|
102
|
-
expect(res).toMatchSnapshot();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
describe('getStorybookUrl', () => {
|
|
106
|
-
test.each([
|
|
107
|
-
{
|
|
108
|
-
params: {
|
|
109
|
-
storybookBaseUrl: 'https://storybook.url',
|
|
110
|
-
filePath: undefined,
|
|
111
|
-
},
|
|
112
|
-
expected: undefined,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
params: {
|
|
116
|
-
storybookBaseUrl: 'https://storybook.url',
|
|
117
|
-
filePath: '/atoms/mg-button',
|
|
118
|
-
},
|
|
119
|
-
expected: 'https://storybook.url--docs',
|
|
120
|
-
},
|
|
121
|
-
])('Should render storybook url', ({ params, expected }) => {
|
|
122
|
-
const result = getStorybookUrl(params.storybookBaseUrl, params.filePath);
|
|
123
|
-
expect(result).toEqual(expected);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
describe('StorybookPreview', () => {
|
|
128
|
-
describe('extractArgTypes', () => {
|
|
129
|
-
test('Should extract arg types', () => {
|
|
130
|
-
const { extractArgTypes } = new StorybookPreview(jsonDocs as JsonDocs);
|
|
131
|
-
let res = extractArgTypes('my-comp');
|
|
132
|
-
expect(res).toMatchSnapshot();
|
|
133
|
-
res = extractArgTypes('my-second-comp');
|
|
134
|
-
expect(res).toMatchSnapshot();
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
describe('extractComponentDescription', () => {
|
|
139
|
-
test('Should extract component description', () => {
|
|
140
|
-
const { extractComponentDescription } = new StorybookPreview(jsonDocs as JsonDocs);
|
|
141
|
-
const res = extractComponentDescription('my-comp');
|
|
142
|
-
expect(res).toMatchSnapshot();
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|