-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathsnapshot.test.ts.snap
379 lines (302 loc) · 14 KB
/
snapshot.test.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`MereProps Order: MereProps Order 1`] = `
"import { createElementVNode as _createElementVNode, mergeProps as _mergeProps, createTextVNode as _createTextVNode } from \\"vue\\";
_createElementVNode(\\"button\\", _mergeProps({
\\"loading\\": true
}, x, {
\\"type\\": \\"submit\\"
}), [_createTextVNode(\\"btn\\")], 16, [\\"loading\\"]);"
`;
exports[`Merge class/ style attributes into array: Merge class/ style attributes into array 1`] = `
"import { createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, normalizeClass as _normalizeClass } from \\"vue\\";
_createElementVNode(\\"div\\", {
\\"class\\": _normalizeClass([\\"a\\", b]),
\\"style\\": _normalizeStyle([\\"color: red\\", s])
}, null, 6);"
`;
exports[`Without JSX should work: Without JSX should work 1`] = `
"import { createVNode } from 'vue';
createVNode('div', null, ['Without JSX should work']);"
`;
exports[`Without props: Without props 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
_createElementVNode(\\"a\\", null, [_createTextVNode(\\"a\\")]);"
`;
exports[`custom directive: custom directive 1`] = `
"import { withDirectives as _withDirectives, createVNode as _createVNode, resolveDirective as _resolveDirective, resolveComponent as _resolveComponent } from \\"vue\\";
_withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"cus\\"), x]]);"
`;
exports[`custom directive: custom directive 2`] = `
"import { createElementVNode as _createElementVNode, withDirectives as _withDirectives, createVNode as _createVNode, resolveDirective as _resolveDirective, resolveComponent as _resolveComponent, Fragment as _Fragment } from \\"vue\\";
_createElementVNode(_Fragment, null, [_withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x]]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x]]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x, 'y']]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x, 'y', {
a: true,
b: true
}]]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x, void 0, {
a: true,
b: true
}]]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x, y, {
a: true,
b: true
}]]), _withDirectives(_createVNode(_resolveComponent(\\"A\\"), null, null, 512), [[_resolveDirective(\\"xxx\\"), x, y, {
a: true,
b: true
}]])]);"
`;
exports[`disable object slot syntax with defaultSlot: defaultSlot 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"Badge\\"), null, {
default: () => [slots.default()],
_: 1
});"
`;
exports[`dynamic type in input: dynamic type in input 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelDynamic as _vModelDynamic } from \\"vue\\";
_withDirectives(_createElementVNode(\\"input\\", {
\\"type\\": type,
\\"onUpdate:modelValue\\": $event => test = $event
}, null, 8, [\\"type\\", \\"onUpdate:modelValue\\"]), [[_vModelDynamic, test]]);"
`;
exports[`input[type="checkbox"]: input[type="checkbox"] 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelCheckbox as _vModelCheckbox } from \\"vue\\";
_withDirectives(_createElementVNode(\\"input\\", {
\\"type\\": \\"checkbox\\",
\\"onUpdate:modelValue\\": $event => test = $event
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelCheckbox, test]]);"
`;
exports[`input[type="radio"]: input[type="radio"] 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelRadio as _vModelRadio, Fragment as _Fragment } from \\"vue\\";
_createElementVNode(_Fragment, null, [_withDirectives(_createElementVNode(\\"input\\", {
\\"type\\": \\"radio\\",
\\"value\\": \\"1\\",
\\"onUpdate:modelValue\\": $event => test = $event,
\\"name\\": \\"test\\"
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelRadio, test]]), _withDirectives(_createElementVNode(\\"input\\", {
\\"type\\": \\"radio\\",
\\"value\\": \\"2\\",
\\"onUpdate:modelValue\\": $event => test = $event,
\\"name\\": \\"test\\"
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelRadio, test]])]);"
`;
exports[`input[type="text"] .lazy modifier: input[type="text"] .lazy modifier 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelText as _vModelText } from \\"vue\\";
_withDirectives(_createElementVNode(\\"input\\", {
\\"onUpdate:modelValue\\": $event => test = $event
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test, void 0, {
lazy: true
}]]);"
`;
exports[`input[type="text"]: input[type="text"] 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelText as _vModelText } from \\"vue\\";
_withDirectives(_createElementVNode(\\"input\\", {
\\"onUpdate:modelValue\\": $event => test = $event
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test]]);"
`;
exports[`isCustomElement: isCustomElement 1`] = `
"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\";
_createVNode(\\"foo\\", null, [_createVNode(\\"span\\", null, [_createTextVNode(\\"foo\\")])]);"
`;
exports[`named import specifier \`Keep Alive\`: named import specifier \`Keep Alive\` 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
import { KeepAlive } from 'vue';
_createElementVNode(KeepAlive, null, [_createTextVNode(\\"123\\")]);"
`;
exports[`namespace specifier \`Keep Alive\`: namespace specifier \`Keep Alive\` 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
import * as Vue from 'vue';
_createElementVNode(Vue.KeepAlive, null, [_createTextVNode(\\"123\\")]);"
`;
exports[`override props multiple: multiple 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"A\\"), {
\\"loading\\": true,
...a,
b: 1,
c: {
d: 2
},
\\"class\\": \\"x\\",
\\"style\\": x
}, null);"
`;
exports[`override props single: single 1`] = `
"import { createVNode as _createVNode } from \\"vue\\";
_createVNode(\\"div\\", a, null);"
`;
exports[`passing object slots via JSX children multiple expressions: multiple expressions 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"A\\"), null, {
default: () => [foo, bar],
_: 1
});"
`;
exports[`passing object slots via JSX children single expression, function expression: single expression, function expression 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"A\\"), null, {
default: () => \\"foo\\"
});"
`;
exports[`passing object slots via JSX children single expression, non-literal value: runtime check: single expression, non-literal value: runtime check 1`] = `
"let _slot;
import { createVNode as _createVNode, isVNode as _isVNode, resolveComponent as _resolveComponent } from \\"vue\\";
function _isSlot(s) {
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
}
const foo = () => 1;
_createVNode(_resolveComponent(\\"A\\"), null, _isSlot(_slot = foo()) ? _slot : {
default: () => [_slot],
_: 1
});"
`;
exports[`reassign variable as component: reassign variable as component 1`] = `
"import { createVNode as _createVNode, isVNode as _isVNode, createElementVNode as _createElementVNode } from \\"vue\\";
import { defineComponent } from 'vue';
function _isSlot(s) {
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
}
let a = 1;
const A = defineComponent({
setup(_, {
slots
}) {
return () => _createElementVNode(\\"span\\", null, [slots.default()]);
}
});
const _a2 = 2;
a = _a2;
const _a = function () {
return a;
}();
a = _createVNode(A, null, _isSlot(a) ? a : {
default: () => [_a],
_: 2
});"
`;
exports[`select: select 1`] = `
"import { withDirectives as _withDirectives, vModelSelect as _vModelSelect, createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
_withDirectives(_createElementVNode(\\"select\\", {
\\"onUpdate:modelValue\\": $event => test = $event
}, [_createElementVNode(\\"option\\", {
\\"value\\": \\"1\\"
}, [_createTextVNode(\\"a\\")]), _createElementVNode(\\"option\\", {
\\"value\\": 2
}, [_createTextVNode(\\"b\\")]), _createElementVNode(\\"option\\", {
\\"value\\": 3
}, [_createTextVNode(\\"c\\")])], 8, [\\"onUpdate:modelValue\\"]), [[_vModelSelect, test]]);"
`;
exports[`set pragma to custom: custom 1`] = `
"import { createTextVNode as _createTextVNode } from \\"vue\\";
custom(\\"div\\", null, [_createTextVNode(\\"pragma\\")]);"
`;
exports[`should keep \`import * as Vue from "vue"\`: should keep \`import * as Vue from "vue"\` 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
import * as Vue from 'vue';
_createElementVNode(\\"div\\", null, [_createTextVNode(\\"Vue\\")]);"
`;
exports[`single no need for a mergeProps call: single no need for a mergeProps call 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
_createElementVNode(\\"div\\", x, [_createTextVNode(\\"single\\")], 16);"
`;
exports[`specifiers should be merged into a single importDeclaration: specifiers should be merged into a single importDeclaration 1`] = `
"import { createElementVNode as _createElementVNode } from \\"vue\\";
import { createVNode, Fragment as _Fragment } from 'vue';
import { vShow } from 'vue';
_createElementVNode(_Fragment, null, null);"
`;
exports[`textarea: textarea 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vModelText as _vModelText } from \\"vue\\";
_withDirectives(_createElementVNode(\\"textarea\\", {
\\"onUpdate:modelValue\\": $event => test = $event
}, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test]]);"
`;
exports[`use "@jsx" comment specify pragma: use "@jsx" comment specify pragma 1`] = `
"import { createElementVNode as _createElementVNode, createTextVNode as _createTextVNode } from \\"vue\\";
/* @jsx custom */
_createElementVNode(\\"div\\", {
\\"id\\": \\"custom\\"
}, [_createTextVNode(\\"Hello\\")]);"
`;
exports[`use "model" as the prop name: use "model" as the prop name 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"C\\"), {
\\"model\\": foo,
\\"onUpdate:model\\": $event => foo = $event
}, null, 8, [\\"model\\", \\"onUpdate:model\\"]);"
`;
exports[`using v-slots without children should not be spread: using v-slots without children should not be spread 1`] = `
"import { createVNode as _createVNode, resolveDirective as _resolveDirective, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"A\\"), null, slots);"
`;
exports[`v-model target value support variable: v-model target value support variable 1`] = `
"import { createElementVNode as _createElementVNode, createVNode as _createVNode, resolveComponent as _resolveComponent, Fragment as _Fragment } from \\"vue\\";
const foo = 'foo';
const a = () => 'a';
const b = {
c: 'c'
};
_createElementVNode(_Fragment, null, [_createVNode(_resolveComponent(\\"A\\"), {
[foo]: xx,
[\\"onUpdate\\" + foo]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent(\\"B\\"), {
\\"modelValue\\": xx,
\\"modelModifiers\\": {
\\"a\\": true
},
\\"onUpdate:modelValue\\": $event => xx = $event
}, null, 8, [\\"modelValue\\", \\"onUpdate:modelValue\\"]), _createVNode(_resolveComponent(\\"C\\"), {
[foo]: xx,
[foo + \\"Modifiers\\"]: {
\\"a\\": true
},
[\\"onUpdate\\" + foo]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent(\\"D\\"), {
[foo === 'foo' ? 'a' : 'b']: xx,
[(foo === 'foo' ? 'a' : 'b') + \\"Modifiers\\"]: {
\\"a\\": true
},
[\\"onUpdate\\" + (foo === 'foo' ? 'a' : 'b')]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent(\\"E\\"), {
[a()]: xx,
[a() + \\"Modifiers\\"]: {
\\"a\\": true
},
[\\"onUpdate\\" + a()]: $event => xx = $event
}, null, 16), _createVNode(_resolveComponent(\\"F\\"), {
[b.c]: xx,
[b.c + \\"Modifiers\\"]: {
\\"a\\": true
},
[\\"onUpdate\\" + b.c]: $event => xx = $event
}, null, 16)]);"
`;
exports[`v-show: v-show 1`] = `
"import { withDirectives as _withDirectives, createElementVNode as _createElementVNode, vShow as _vShow, createTextVNode as _createTextVNode } from \\"vue\\";
_withDirectives(_createElementVNode(\\"div\\", null, [_createTextVNode(\\"vShow\\")], 512), [[_vShow, x]]);"
`;
exports[`vHtml: vHtml 1`] = `
"import { createElementVNode as _createElementVNode } from \\"vue\\";
_createElementVNode(\\"h1\\", {
\\"innerHTML\\": \\"<div>foo</div>\\"
}, null, 8, [\\"innerHTML\\"]);"
`;
exports[`vModels: vModels 1`] = `
"import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\";
_createVNode(_resolveComponent(\\"C\\"), {
\\"modelValue\\": foo,
\\"modelModifiers\\": {
\\"modifier\\": true
},
\\"onUpdate:modelValue\\": $event => foo = $event,
\\"bar\\": bar,
\\"barModifiers\\": {
\\"modifier1\\": true,
\\"modifier2\\": true
},
\\"onUpdate:bar\\": $event => bar = $event
}, null, 8, [\\"modelValue\\", \\"onUpdate:modelValue\\", \\"bar\\", \\"onUpdate:bar\\"]);"
`;
exports[`vText: vText 1`] = `
"import { createElementVNode as _createElementVNode } from \\"vue\\";
_createElementVNode(\\"div\\", {
\\"textContent\\": text
}, null, 8, [\\"textContent\\"]);"
`;