Skip to content

Commit 4a05c9e

Browse files
committed
chore: update deps
1 parent 634ce68 commit 4a05c9e

File tree

4 files changed

+196
-213
lines changed

4 files changed

+196
-213
lines changed
Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,50 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`compile > dynamic root 1`] = `
4+
"
5+
const n0 = _createNodes(1, 2)
6+
return n0
7+
"
8+
`;
9+
10+
exports[`compile > dynamic root 2`] = `
11+
"
12+
const n0 = t0()
13+
const x0 = _child(n0)
14+
_setNodes(x0, () => (a +b + c))
15+
return n0
16+
"
17+
`;
18+
19+
exports[`compile > expression parsing > interpolation 1`] = `
20+
"
21+
const n0 = _createNodes(() => (a + b))
22+
return n0
23+
"
24+
`;
25+
326
exports[`compile > setInsertionState > next, child and nthChild should be above the setInsertionState 1`] = `
427
"
5-
const n3 = t0()
6-
const n2 = _next(_child(n3))
7-
const p0 = _nthChild(n3, 4)
8-
const n1 = _child(p0)
9-
_setInsertionState(n3, n2)
28+
const n6 = t1()
29+
const n5 = _next(_child(n6))
30+
const n7 = _nthChild(n6, 3)
31+
const p0 = _next(n7)
32+
const n4 = _child(p0)
33+
_setInsertionState(n6, n5)
1034
const n0 = _createComponent(Comp)
11-
_renderEffect(() => _setProp(n1, "disabled", foo))
12-
return n3
35+
_setInsertionState(n6, n7)
36+
const n1 = _createIf(() => (true), () => {
37+
const n3 = t0()
38+
return n3
39+
})
40+
_renderEffect(() => _setProp(n4, "disabled", foo))
41+
return n6
42+
"
43+
`;
44+
45+
exports[`compile > static template 1`] = `
46+
"
47+
const n0 = t0()
48+
return n0
1349
"
1450
`;

packages/compiler/test/compile.spec.ts

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
11
import { describe, expect, test } from 'vitest'
2-
import {
3-
transformChildren,
4-
transformElement,
5-
transformTemplateRef,
6-
transformText,
7-
transformVBind,
8-
transformVHtml,
9-
transformVModel,
10-
transformVOn,
11-
transformVShow,
12-
transformVSlot,
13-
transformVSlots,
14-
} from '../src'
15-
import { makeCompile } from './transforms/_utils'
16-
17-
const compile = makeCompile({
18-
nodeTransforms: [
19-
transformTemplateRef,
20-
transformText,
21-
transformElement,
22-
transformVSlot,
23-
transformChildren,
24-
],
25-
directiveTransforms: {
26-
bind: transformVBind,
27-
on: transformVOn,
28-
model: transformVModel,
29-
show: transformVShow,
30-
html: transformVHtml,
31-
slots: transformVSlots,
32-
},
33-
})
2+
import { compile } from '../src'
343

354
describe('compile', () => {
365
test('static template', () => {
@@ -41,47 +10,25 @@ describe('compile', () => {
4110
<span />
4211
</div>`,
4312
)
44-
expect(code).toMatchInlineSnapshot(`
45-
"
46-
const n0 = t0()
47-
return n0
48-
"
49-
`)
13+
expect(code).toMatchSnapshot()
5014
})
5115

5216
test('dynamic root', () => {
5317
const { code } = compile(`<>{ 1 }{ 2 }</>`)
54-
expect(code).toMatchInlineSnapshot(`
55-
"
56-
const n0 = _createNodes(1, 2)
57-
return n0
58-
"
59-
`)
18+
expect(code).toMatchSnapshot()
6019
})
6120

6221
test('dynamic root', () => {
6322
const { code } = compile(`<div>{a +b + c }</div>`)
64-
expect(code).toMatchInlineSnapshot(`
65-
"
66-
const n0 = t0()
67-
const x0 = _child(n0)
68-
_setNodes(x0, () => (a +b + c))
69-
return n0
70-
"
71-
`)
23+
expect(code).toMatchSnapshot()
7224
})
7325

7426
describe('expression parsing', () => {
7527
test('interpolation', () => {
7628
const { code } = compile(`<>{ a + b }</>`, {
7729
inline: true,
7830
})
79-
expect(code).toMatchInlineSnapshot(`
80-
"
81-
const n0 = _createNodes(() => (a + b))
82-
return n0
83-
"
84-
`)
31+
expect(code).toMatchSnapshot()
8532
expect(code).contains('a + b')
8633
})
8734
})

0 commit comments

Comments
 (0)