Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit b421aa9

Browse files
LittleSoundsxzz
andauthored
test: combine with transform and codegen tests for v-bind (#45)
Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
1 parent 12250a8 commit b421aa9

File tree

2 files changed

+110
-131
lines changed

2 files changed

+110
-131
lines changed

packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`compiler: codegen v-bind > .camel modifier 1`] = `
3+
exports[`compiler v-bind > .camel modifier 1`] = `
44
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
55
66
export function render(_ctx) {
@@ -14,35 +14,35 @@ export function render(_ctx) {
1414
}"
1515
`;
1616

17-
exports[`compiler: codegen v-bind > dynamic arg 1`] = `
18-
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
17+
exports[`compiler v-bind > .camel modifier w/ dynamic arg 1`] = `
18+
"import { camelize as _camelize } from 'vue';
1919
2020
export function render(_ctx) {
2121
const t0 = _template("<div></div>")
2222
const n0 = t0()
2323
const { 0: [n1],} = _children(n0)
2424
_effect(() => {
25-
_setAttr(n1, _ctx.id, undefined, _ctx.id)
25+
_setAttr(n1, _camelize(_ctx.foo), undefined, _ctx.id)
2626
})
2727
return n0
2828
}"
2929
`;
3030

31-
exports[`compiler: codegen v-bind > no expression (shorthand) 1`] = `
31+
exports[`compiler v-bind > .camel modifier w/ no expression 1`] = `
3232
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
3333
3434
export function render(_ctx) {
3535
const t0 = _template("<div></div>")
3636
const n0 = t0()
3737
const { 0: [n1],} = _children(n0)
3838
_effect(() => {
39-
_setAttr(n1, "camel-case", undefined, _ctx.camelCase)
39+
_setAttr(n1, "fooBar", undefined, _ctx.fooBar)
4040
})
4141
return n0
4242
}"
4343
`;
4444

45-
exports[`compiler: codegen v-bind > no expression 1`] = `
45+
exports[`compiler v-bind > basic 1`] = `
4646
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
4747
4848
export function render(_ctx) {
@@ -56,17 +56,35 @@ export function render(_ctx) {
5656
}"
5757
`;
5858

59-
exports[`compiler: codegen v-bind > should error if no expression 1`] = `
60-
"import { template as _template } from 'vue/vapor';
59+
exports[`compiler v-bind > dynamic arg 1`] = `
60+
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
6161
6262
export function render(_ctx) {
63-
const t0 = _template("<div arg=\\"\\"></div>")
63+
const t0 = _template("<div></div>")
6464
const n0 = t0()
65+
const { 0: [n1],} = _children(n0)
66+
_effect(() => {
67+
_setAttr(n1, _ctx.id, undefined, _ctx.id)
68+
})
6569
return n0
6670
}"
6771
`;
6872

69-
exports[`compiler: codegen v-bind > simple expression 1`] = `
73+
exports[`compiler v-bind > no expression (shorthand) 1`] = `
74+
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
75+
76+
export function render(_ctx) {
77+
const t0 = _template("<div></div>")
78+
const n0 = t0()
79+
const { 0: [n1],} = _children(n0)
80+
_effect(() => {
81+
_setAttr(n1, "camel-case", undefined, _ctx.camelCase)
82+
})
83+
return n0
84+
}"
85+
`;
86+
87+
exports[`compiler v-bind > no expression 1`] = `
7088
"import { template as _template, children as _children, effect as _effect, setAttr as _setAttr } from 'vue/vapor';
7189
7290
export function render(_ctx) {
@@ -79,3 +97,13 @@ export function render(_ctx) {
7997
return n0
8098
}"
8199
`;
100+
101+
exports[`compiler v-bind > should error if empty expression 1`] = `
102+
"import { template as _template } from 'vue/vapor';
103+
104+
export function render(_ctx) {
105+
const t0 = _template("<div arg=\\"\\"></div>")
106+
const n0 = t0()
107+
return n0
108+
}"
109+
`;

0 commit comments

Comments
 (0)