Skip to content

Commit 52a8fa2

Browse files
committed
fix: bugs detected by rebased tests, update expects
1 parent 9a3468c commit 52a8fa2

15 files changed

+116
-139
lines changed

packages/compiler-vapor/__tests__/__snapshots__/compile.spec.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function render(_ctx) {
238238
239239
exports[`compile > execution order > with insertionState 1`] = `
240240
"import { resolveComponent as _resolveComponent, child as _child, setInsertionState as _setInsertionState, createSlot as _createSlot, createComponentWithFallback as _createComponentWithFallback, template as _template } from 'vue';
241-
const t0 = _template("<div><div></div></div>", true)
241+
const t0 = _template("<div><div>", true)
242242
243243
export function render(_ctx) {
244244
const _component_Comp = _resolveComponent("Comp")
@@ -292,7 +292,7 @@ exports[`compile > expression parsing > v-bind 1`] = `
292292
293293
exports[`compile > expression parsing > v-for 1`] = `
294294
"import { createFor as _createFor, template as _template } from 'vue';
295-
const t0 = _template("<div></div>")
295+
const t0 = _template("<div>")
296296
297297
export function render(_ctx) {
298298
const n0 = _createFor(() => (_ctx.a.b), (_for_item0, _for_key0, _for_index0) => {
@@ -305,7 +305,7 @@ export function render(_ctx) {
305305
306306
exports[`compile > expression parsing > v-on multi statements 1`] = `
307307
"import { createInvoker as _createInvoker, delegateEvents as _delegateEvents, template as _template } from 'vue';
308-
const t0 = _template("<div></div>", true)
308+
const t0 = _template("<div>", true)
309309
_delegateEvents("click")
310310
311311
export function render(_ctx) {
@@ -348,7 +348,7 @@ export function render(_ctx) {
348348
349349
exports[`compile > gen unique helper alias > should avoid conflicts with existing variable names 1`] = `
350350
"import { txt as _txt2, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, template as _template } from 'vue';
351-
const t0 = _template("<div> </div>", true)
351+
const t0 = _template("<div> ", true)
352352
353353
export function render(_ctx, $props, $emit, $attrs, $slots) {
354354
const n0 = t0()
@@ -360,7 +360,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
360360
361361
exports[`compile > gen unique node variables > should avoid binding conflicts for node vars (n*/x*) 1`] = `
362362
"import { txt as _txt, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, template as _template } from 'vue';
363-
const t0 = _template("<div> </div>")
363+
const t0 = _template("<div> ")
364364
365365
export function render(_ctx, $props, $emit, $attrs, $slots) {
366366
const n1 = t0()
@@ -378,7 +378,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
378378
379379
exports[`compile > gen unique node variables > should bump old ref var (r*) on conflict 1`] = `
380380
"import { createTemplateRefSetter as _createTemplateRefSetter, renderEffect as _renderEffect, template as _template } from 'vue';
381-
const t0 = _template("<div></div>")
381+
const t0 = _template("<div>")
382382
383383
export function render(_ctx, $props, $emit, $attrs, $slots) {
384384
const _setTemplateRef = _createTemplateRefSetter()
@@ -400,7 +400,7 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
400400
401401
exports[`compile > gen unique node variables > should bump placeholder var (p*) on conflict 1`] = `
402402
"import { child as _child, setProp as _setProp, renderEffect as _renderEffect, template as _template } from 'vue';
403-
const t0 = _template("<div><div><div><span></span></div></div></div>", true)
403+
const t0 = _template("<div><div><div><span>", true)
404404
405405
export function render(_ctx, $props, $emit, $attrs, $slots) {
406406
const n1 = t0()
@@ -414,9 +414,9 @@ export function render(_ctx, $props, $emit, $attrs, $slots) {
414414
415415
exports[`compile > gen unique node variables > should bump template var (t*) on conflict 1`] = `
416416
"import { template as _template } from 'vue';
417-
const t1 = _template("<div></div>")
418-
const t3 = _template("<span></span>")
419-
const t4 = _template("<p></p>")
417+
const t1 = _template("<div>")
418+
const t3 = _template("<span>")
419+
const t4 = _template("<p>")
420420
421421
export function render(_ctx, $props, $emit, $attrs, $slots) {
422422
const n0 = t1()

packages/compiler-vapor/__tests__/__snapshots__/scopeId.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`scopeId compiler support > should wrap default slot 1`] = `
44
"import { resolveComponent as _resolveComponent, withVaporCtx as _withVaporCtx, createComponentWithFallback as _createComponentWithFallback, template as _template } from 'vue';
5-
const t0 = _template("<div></div>")
5+
const t0 = _template("<div>")
66
77
export function render(_ctx) {
88
const _component_Child = _resolveComponent("Child")
@@ -18,7 +18,7 @@ export function render(_ctx) {
1818
1919
exports[`scopeId compiler support > should wrap dynamic slots 1`] = `
2020
"import { resolveComponent as _resolveComponent, withVaporCtx as _withVaporCtx, createForSlots as _createForSlots, createComponentWithFallback as _createComponentWithFallback, template as _template } from 'vue';
21-
const t0 = _template("<div test></div>")
21+
const t0 = _template("<div test>")
2222
2323
export function render(_ctx) {
2424
const _component_Child = _resolveComponent("Child")
@@ -49,7 +49,7 @@ export function render(_ctx) {
4949
exports[`scopeId compiler support > should wrap named slots 1`] = `
5050
"import { resolveComponent as _resolveComponent, toDisplayString as _toDisplayString, setText as _setText, renderEffect as _renderEffect, withVaporCtx as _withVaporCtx, createComponentWithFallback as _createComponentWithFallback, template as _template } from 'vue';
5151
const t0 = _template(" ")
52-
const t1 = _template("<div test></div>")
52+
const t1 = _template("<div test>")
5353
5454
export function render(_ctx) {
5555
const _component_Child = _resolveComponent("Child")

packages/compiler-vapor/__tests__/compile.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ describe('compile', () => {
353353
expect(code).matchSnapshot()
354354
expect(code).not.contains('const t0 =')
355355
expect(code).not.contains('const t2 =')
356-
expect(code).contains('const t1 = _template("<div></div>")')
357-
expect(code).contains('const t3 = _template("<span></span>")')
358-
expect(code).contains('const t4 = _template("<p></p>")')
356+
expect(code).contains('const t1 = _template("<div>")')
357+
expect(code).contains('const t3 = _template("<span>")')
358+
expect(code).contains('const t4 = _template("<p>")')
359359
})
360360

361361
test('should bump placeholder var (p*) on conflict', () => {

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`compiler: transition > basic 1`] = `
44
"import { VaporTransition as _VaporTransition, applyVShow as _applyVShow, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
5-
const t0 = _template("<h1>foo</h1>")
5+
const t0 = _template("<h1>foo")
66
77
export function render(_ctx) {
88
const n1 = _createComponent(_VaporTransition, { persisted: () => ("") }, {
@@ -18,7 +18,7 @@ export function render(_ctx) {
1818
1919
exports[`compiler: transition > inject persisted when child has v-show 1`] = `
2020
"import { VaporTransition as _VaporTransition, applyVShow as _applyVShow, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
21-
const t0 = _template("<div></div>")
21+
const t0 = _template("<div>")
2222
2323
export function render(_ctx) {
2424
const n1 = _createComponent(_VaporTransition, { persisted: () => ("") }, {
@@ -34,9 +34,9 @@ export function render(_ctx) {
3434
3535
exports[`compiler: transition > the v-if/else-if/else branches in Transition should ignore comments 1`] = `
3636
"import { VaporTransition as _VaporTransition, setInsertionState as _setInsertionState, createIf as _createIf, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
37-
const t0 = _template("<div>hey</div>")
38-
const t1 = _template("<p></p>")
39-
const t2 = _template("<div></div>")
37+
const t0 = _template("<div>hey")
38+
const t1 = _template("<p>")
39+
const t2 = _template("<div>")
4040
4141
export function render(_ctx) {
4242
const n16 = _createComponent(_VaporTransition, null, {
@@ -71,7 +71,7 @@ export function render(_ctx) {
7171
7272
exports[`compiler: transition > v-show + appear 1`] = `
7373
"import { VaporTransition as _VaporTransition, applyVShow as _applyVShow, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
74-
const t0 = _template("<h1>foo</h1>")
74+
const t0 = _template("<h1>foo")
7575
7676
export function render(_ctx) {
7777
const deferredApplyVShows = []
@@ -92,7 +92,7 @@ export function render(_ctx) {
9292
9393
exports[`compiler: transition > work with dynamic keyed children 1`] = `
9494
"import { VaporTransition as _VaporTransition, createKeyedFragment as _createKeyedFragment, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
95-
const t0 = _template("<h1>foo</h1>")
95+
const t0 = _template("<h1>foo")
9696
9797
export function render(_ctx) {
9898
const n1 = _createComponent(_VaporTransition, null, {
@@ -110,7 +110,7 @@ export function render(_ctx) {
110110
111111
exports[`compiler: transition > work with v-if 1`] = `
112112
"import { VaporTransition as _VaporTransition, createIf as _createIf, withVaporCtx as _withVaporCtx, createComponent as _createComponent, template as _template } from 'vue';
113-
const t0 = _template("<h1>foo</h1>")
113+
const t0 = _template("<h1>foo")
114114
115115
export function render(_ctx) {
116116
const n3 = _createComponent(_VaporTransition, null, {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function render(_ctx) {
4343
exports[`compiler sfc: transform asset url > support uri fragment 1`] = `
4444
"import { template as _template } from 'vue';
4545
import _imports_0 from '@svg/file.svg';
46-
const t0 = _template("<use href=\\"" + _imports_0 + '#fragment' + "\\"></use>", false, 1)
46+
const t0 = _template("<use href=\\"" + _imports_0 + '#fragment' + "\\">", false, 1)
4747
4848
export function render(_ctx) {
4949
const n0 = t0()
@@ -54,7 +54,7 @@ export function render(_ctx) {
5454
5555
exports[`compiler sfc: transform asset url > support uri is empty 1`] = `
5656
"import { template as _template } from 'vue';
57-
const t0 = _template("<use href=\\"\\"></use>", true, 1)
57+
const t0 = _template("<use href=\\"\\">", true, 1)
5858
5959
export function render(_ctx) {
6060
const n0 = t0()
@@ -90,7 +90,7 @@ exports[`compiler sfc: transform asset url > transform with stringify 1`] = `
9090
"import { template as _template } from 'vue';
9191
import _imports_0 from './bar.png';
9292
import _imports_1 from '/bar.png';
93-
const t0 = _template("<div><img src=\\"" + _imports_0 + "\\"><img src=\\"" + _imports_1 + "\\"><img src=\\"https://foo.bar/baz.png\\"><img src=\\"//foo.bar/baz.png\\"><img src=\\"" + _imports_0 + "\\"></div>", true)
93+
const t0 = _template("<div><img src=\\"" + _imports_0 + "\\"><img src=\\"" + _imports_1 + "\\"><img src=\\"https://foo.bar/baz.png\\"><img src=\\"//foo.bar/baz.png\\"><img src=\\"" + _imports_0 + "\\">", true)
9494
9595
export function render(_ctx) {
9696
const n0 = t0()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ exports[`compiler sfc: transform srcset > transform srcset w/ stringify 1`] = `
117117
"import { template as _template } from 'vue';
118118
import _imports_0 from './logo.png';
119119
import _imports_1 from '/logo.png';
120-
const t0 = _template("<div><img src=\\"" + _imports_0 + "\\" srcset><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ', ' + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x, ' + _imports_0 + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x, ' + _imports_0 + ' 3x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ', ' + _imports_0 + ' 2x, ' + _imports_0 + ' 3x' + "\\"><img src=\\"" + _imports_1 + "\\" srcset=\\"" + _imports_1 + ', ' + _imports_1 + ' 2x' + "\\"><img src=\\"https://example.com/logo.png\\" srcset=\\"https://example.com/logo.png, https://example.com/logo.png 2x\\"><img src=\\"" + _imports_1 + "\\" srcset=\\"" + _imports_1 + ', ' + _imports_0 + ' 2x' + "\\"><img src=\\"data:image/png;base64,i\\" srcset=\\"data:image/png;base64,i 1x, data:image/png;base64,i 2x\\"></div>", true)
120+
const t0 = _template("<div><img src=\\"" + _imports_0 + "\\" srcset><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ', ' + _imports_0 + ' 2x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x, ' + _imports_0 + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ' 2x, ' + _imports_0 + ' 3x' + "\\"><img src=\\"" + _imports_0 + "\\" srcset=\\"" + _imports_0 + ', ' + _imports_0 + ' 2x, ' + _imports_0 + ' 3x' + "\\"><img src=\\"" + _imports_1 + "\\" srcset=\\"" + _imports_1 + ', ' + _imports_1 + ' 2x' + "\\"><img src=\\"https://example.com/logo.png\\" srcset=\\"https://example.com/logo.png, https://example.com/logo.png 2x\\"><img src=\\"" + _imports_1 + "\\" srcset=\\"" + _imports_1 + ', ' + _imports_0 + ' 2x' + "\\"><img src=\\"data:image/png;base64,i\\" srcset=\\"data:image/png;base64,i 1x, data:image/png;base64,i 2x\\">", true)
121121
122122
export function render(_ctx) {
123123
const n0 = t0()

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

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

3-
exports[`compiler: element transform > b in nested divs 1`] = `
3+
exports[`compiler: element transform > MathML 1`] = `
44
"import { template as _template } from 'vue';
5-
const t0 = _template("<div><div><b></b></div><div>", true)
5+
const t0 = _template("<math><mrow><mi>x", true, 2)
66
77
export function render(_ctx) {
88
const n0 = t0()
99
return n0
1010
}"
1111
`;
1212
13-
exports[`compiler: element transform > MathML 1`] = `
13+
exports[`compiler: element transform > b in nested divs 1`] = `
1414
"import { template as _template } from 'vue';
15-
const t0 = _template("<math><mrow><mi>x</mi></mrow></math>", true, 2)
15+
const t0 = _template("<div><div><b></b></div><div>", true)
1616
1717
export function render(_ctx) {
1818
const n0 = t0()
@@ -562,7 +562,7 @@ export function render(_ctx) {
562562
563563
exports[`compiler: element transform > svg 1`] = `
564564
"import { template as _template } from 'vue';
565-
const t0 = _template("<svg><circle r=\\"40\\"></circle></svg>", true, 1)
565+
const t0 = _template("<svg><circle r=\\"40\\">", true, 1)
566566
567567
export function render(_ctx) {
568568
const n0 = t0()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function render(_ctx) {
1313

1414
exports[`compiler: text transform > constant text 1`] = `
1515
"import { child as _child, template as _template } from 'vue';
16-
const t0 = _template("<div>2 foo1 1 1 1</div>", true)
16+
const t0 = _template("<div>2 foo1 1 1 1", true)
1717
1818
export function render(_ctx) {
1919
const n1 = t0()

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

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`cache multiple access > TSNonNullExpression 1`] = `
44
"import { setProp as _setProp, renderEffect as _renderEffect, template as _template } from 'vue';
5-
const t0 = _template("<div></div>", true)
5+
const t0 = _template("<div>", true)
66
77
export function render(_ctx) {
88
const n0 = t0()
@@ -59,7 +59,7 @@ export function render(_ctx) {
5959
6060
exports[`cache multiple access > dynamic property access with parentheses 1`] = `
6161
"import { setProp as _setProp, renderEffect as _renderEffect, template as _template } from 'vue';
62-
const t0 = _template("<div></div>", true)
62+
const t0 = _template("<div>", true)
6363
6464
export function render(_ctx) {
6565
const n0 = t0()
@@ -240,7 +240,7 @@ export function render(_ctx) {
240240
241241
exports[`cache multiple access > shared member root 1`] = `
242242
"import { setProp as _setProp, renderEffect as _renderEffect, template as _template } from 'vue';
243-
const t0 = _template("<div></div>")
243+
const t0 = _template("<div>")
244244
245245
export function render(_ctx) {
246246
const n0 = t0()
@@ -256,7 +256,7 @@ export function render(_ctx) {
256256
257257
exports[`cache multiple access > shared member root with TSNonNullExpression 1`] = `
258258
"import { setProp as _setProp, renderEffect as _renderEffect, template as _template } from 'vue';
259-
const t0 = _template("<div></div>")
259+
const t0 = _template("<div>")
260260
261261
export function render(_ctx) {
262262
const n0 = t0()
@@ -361,24 +361,13 @@ export function render(_ctx) {
361361
}"
362362
`;
363363
364-
exports[`compiler v-bind > .camel modifier w/ dynamic arg + prefixIdentifiers 1`] = `
365-
"import { camelize as _camelize, setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
366-
const t0 = _template("<div></div>", true)
367-
368-
export function render(_ctx) {
369-
const n0 = t0()
370-
_renderEffect(() => _setDynamicProps(n0, [{ [_camelize(_ctx.foo(_ctx.bar) || "")]: _ctx.id }]))
371-
return n0
372-
}"
373-
`;
374-
375364
exports[`compiler v-bind > .camel modifier w/ dynamic arg + prefixIdentifiers 1`] = `
376365
"import { camelize as _camelize, setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
377366
const t0 = _template("<div>", true)
378367
379368
export function render(_ctx) {
380369
const n0 = t0()
381-
_renderEffect(() => _setDynamicProps(n0, [{ [_camelize(_ctx.foo || "")]: _ctx.id }]))
370+
_renderEffect(() => _setDynamicProps(n0, [{ [_camelize(_ctx.foo(_ctx.bar) || "")]: _ctx.id }]))
382371
return n0
383372
}"
384373
`;
@@ -493,17 +482,6 @@ export function render(_ctx) {
493482
}"
494483
`;
495484
496-
exports[`compiler v-bind > .prop modifier w/ dynamic arg + prefixIdentifiers 1`] = `
497-
"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
498-
const t0 = _template("<div>", true)
499-
500-
export function render(_ctx) {
501-
const n0 = t0()
502-
_renderEffect(() => _setDynamicProps(n0, [{ ["." + _ctx.foo(_ctx.bar)]: _ctx.id }]))
503-
return n0
504-
}"
505-
`;
506-
507485
exports[`compiler v-bind > .prop modifier w/ dynamic arg 1`] = `
508486
"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
509487
const t0 = _template("<div>", true)
@@ -572,7 +550,7 @@ export function render(_ctx) {
572550
573551
exports[`compiler v-bind > :class w/ svg elements 1`] = `
574552
"import { setAttr as _setAttr, renderEffect as _renderEffect, template as _template } from 'vue';
575-
const t0 = _template("<svg></svg>", true, 1)
553+
const t0 = _template("<svg>", true, 1)
576554
577555
export function render(_ctx) {
578556
const n0 = t0()
@@ -749,7 +727,7 @@ export function render(_ctx) {
749727
750728
exports[`compiler v-bind > v-bind w/ svg elements 1`] = `
751729
"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
752-
const t0 = _template("<svg></svg>", true, 1)
730+
const t0 = _template("<svg>", true, 1)
753731
754732
export function render(_ctx) {
755733
const n0 = t0()

0 commit comments

Comments
 (0)