Skip to content

Commit ba29b4c

Browse files
FireBushtreesxzz
andauthored
test(compiler-vapor): v-model (#132)
Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
1 parent ebc157c commit ba29b4c

File tree

3 files changed

+409
-2
lines changed

3 files changed

+409
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`compiler: vModel transform > modifiers > .lazy 1`] = `
4+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
5+
const t0 = _template("<input>")
6+
7+
export function render(_ctx) {
8+
const n0 = t0()
9+
const n1 = _children(n0, 0)
10+
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { lazy: true }]])
11+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
12+
return n0
13+
}"
14+
`;
15+
16+
exports[`compiler: vModel transform > modifiers > .number 1`] = `
17+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
18+
const t0 = _template("<input>")
19+
20+
export function render(_ctx) {
21+
const n0 = t0()
22+
const n1 = _children(n0, 0)
23+
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { number: true }]])
24+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
25+
return n0
26+
}"
27+
`;
28+
29+
exports[`compiler: vModel transform > modifiers > .trim 1`] = `
30+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
31+
const t0 = _template("<input>")
32+
33+
export function render(_ctx) {
34+
const n0 = t0()
35+
const n1 = _children(n0, 0)
36+
_withDirectives(n1, [[_vModelText, () => _ctx.model, void 0, { trim: true }]])
37+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
38+
return n0
39+
}"
40+
`;
41+
42+
exports[`compiler: vModel transform > should support input (checkbox) 1`] = `
43+
"import { children as _children, vModelCheckbox as _vModelCheckbox, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
44+
const t0 = _template("<input type=\\"checkbox\\">")
45+
46+
export function render(_ctx) {
47+
const n0 = t0()
48+
const n1 = _children(n0, 0)
49+
_withDirectives(n1, [[_vModelCheckbox, () => _ctx.model]])
50+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
51+
return n0
52+
}"
53+
`;
54+
55+
exports[`compiler: vModel transform > should support input (dynamic type) 1`] = `
56+
"import { children as _children, vModelDynamic as _vModelDynamic, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
57+
const t0 = _template("<input>")
58+
59+
export function render(_ctx) {
60+
const n0 = t0()
61+
const n1 = _children(n0, 0)
62+
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
63+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
64+
return n0
65+
}"
66+
`;
67+
68+
exports[`compiler: vModel transform > should support input (radio) 1`] = `
69+
"import { children as _children, vModelRadio as _vModelRadio, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
70+
const t0 = _template("<input type=\\"radio\\">")
71+
72+
export function render(_ctx) {
73+
const n0 = t0()
74+
const n1 = _children(n0, 0)
75+
_withDirectives(n1, [[_vModelRadio, () => _ctx.model]])
76+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
77+
return n0
78+
}"
79+
`;
80+
81+
exports[`compiler: vModel transform > should support input (text) 1`] = `
82+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
83+
const t0 = _template("<input type=\\"text\\">")
84+
85+
export function render(_ctx) {
86+
const n0 = t0()
87+
const n1 = _children(n0, 0)
88+
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
89+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
90+
return n0
91+
}"
92+
`;
93+
94+
exports[`compiler: vModel transform > should support select 1`] = `
95+
"import { children as _children, vModelSelect as _vModelSelect, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
96+
const t0 = _template("<select></select>")
97+
98+
export function render(_ctx) {
99+
const n0 = t0()
100+
const n1 = _children(n0, 0)
101+
_withDirectives(n1, [[_vModelSelect, () => _ctx.model]])
102+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
103+
return n0
104+
}"
105+
`;
106+
107+
exports[`compiler: vModel transform > should support simple expression 1`] = `
108+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
109+
const t0 = _template("<input>")
110+
111+
export function render(_ctx) {
112+
const n0 = t0()
113+
const n1 = _children(n0, 0)
114+
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
115+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
116+
return n0
117+
}"
118+
`;
119+
120+
exports[`compiler: vModel transform > should support textarea 1`] = `
121+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
122+
const t0 = _template("<textarea></textarea>")
123+
124+
export function render(_ctx) {
125+
const n0 = t0()
126+
const n1 = _children(n0, 0)
127+
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
128+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
129+
return n0
130+
}"
131+
`;
132+
133+
exports[`compiler: vModel transform > should support w/ dynamic v-bind 1`] = `
134+
"import { children as _children, vModelDynamic as _vModelDynamic, withDirectives as _withDirectives, on as _on, renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor';
135+
const t0 = _template("<input>")
136+
137+
export function render(_ctx) {
138+
const n0 = t0()
139+
const n1 = _children(n0, 0)
140+
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
141+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
142+
_renderEffect(() => _setDynamicProps(n1, _ctx.obj))
143+
return n0
144+
}"
145+
`;
146+
147+
exports[`compiler: vModel transform > should support w/ dynamic v-bind 2`] = `
148+
"import { children as _children, vModelDynamic as _vModelDynamic, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
149+
const t0 = _template("<input>")
150+
151+
export function render(_ctx) {
152+
const n0 = t0()
153+
const n1 = _children(n0, 0)
154+
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
155+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
156+
return n0
157+
}"
158+
`;
159+
160+
exports[`compiler: vModel transform > should work with input (checkbox) 1`] = `
161+
"import { children as _children, vModelCheckbox as _vModelCheckbox, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
162+
const t0 = _template("<input type=\\"checkbox\\">")
163+
164+
export function render(_ctx) {
165+
const n0 = t0()
166+
const n1 = _children(n0, 0)
167+
_withDirectives(n1, [[_vModelCheckbox, () => _ctx.model]])
168+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
169+
return n0
170+
}"
171+
`;
172+
173+
exports[`compiler: vModel transform > should work with input (dynamic type) 1`] = `
174+
"import { children as _children, vModelDynamic as _vModelDynamic, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
175+
const t0 = _template("<input>")
176+
177+
export function render(_ctx) {
178+
const n0 = t0()
179+
const n1 = _children(n0, 0)
180+
_withDirectives(n1, [[_vModelDynamic, () => _ctx.model]])
181+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
182+
return n0
183+
}"
184+
`;
185+
186+
exports[`compiler: vModel transform > should work with input (radio) 1`] = `
187+
"import { children as _children, vModelRadio as _vModelRadio, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
188+
const t0 = _template("<input type=\\"radio\\">")
189+
190+
export function render(_ctx) {
191+
const n0 = t0()
192+
const n1 = _children(n0, 0)
193+
_withDirectives(n1, [[_vModelRadio, () => _ctx.model]])
194+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
195+
return n0
196+
}"
197+
`;
198+
199+
exports[`compiler: vModel transform > should work with input (text) 1`] = `
200+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
201+
const t0 = _template("<input type=\\"text\\">")
202+
203+
export function render(_ctx) {
204+
const n0 = t0()
205+
const n1 = _children(n0, 0)
206+
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
207+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
208+
return n0
209+
}"
210+
`;
211+
212+
exports[`compiler: vModel transform > should work with select 1`] = `
213+
"import { children as _children, vModelSelect as _vModelSelect, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
214+
const t0 = _template("<select></select>")
215+
216+
export function render(_ctx) {
217+
const n0 = t0()
218+
const n1 = _children(n0, 0)
219+
_withDirectives(n1, [[_vModelSelect, () => _ctx.model]])
220+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
221+
return n0
222+
}"
223+
`;
224+
225+
exports[`compiler: vModel transform > should work with simple expression 1`] = `
226+
"import { children as _children, vModelText as _vModelText, withDirectives as _withDirectives, on as _on, template as _template } from 'vue/vapor';
227+
const t0 = _template("<input>")
228+
229+
export function render(_ctx) {
230+
const n0 = t0()
231+
const n1 = _children(n0, 0)
232+
_withDirectives(n1, [[_vModelText, () => _ctx.model]])
233+
_on(n1, "update:modelValue", $event => (_ctx.model = $event))
234+
return n0
235+
}"
236+
`;

0 commit comments

Comments
 (0)