Skip to content

Commit 1e428d2

Browse files
committed
test: add class & style
1 parent aed85a4 commit 1e428d2

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`compiler: element transform > props merging: class 1`] = `
4+
"
5+
const n0 = _createComponent(Foo, { class: () => (["foo", { bar: isBar }]) })
6+
return n0
7+
"
8+
`;
9+
10+
exports[`compiler: element transform > props merging: style 1`] = `
11+
"
12+
const n0 = _createComponent(Foo, { style: () => (["color: green", { color: 'red' }]) })
13+
return n0
14+
"
15+
`;

packages/compiler/test/transforms/transformElement.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,18 @@ describe('compiler: element transform', () => {
5454
expect(code).contains(`Foo.Example`)
5555
expect(helpers).not.toContain('resolveComponent')
5656
})
57+
58+
test('props merging: style', () => {
59+
const { code } = compileWithElementTransform(
60+
`<Foo style="color: green" style={{ color: 'red' }} />`,
61+
)
62+
expect(code).toMatchSnapshot()
63+
})
64+
65+
test('props merging: class', () => {
66+
const { code } = compileWithElementTransform(
67+
`<Foo class="foo" class={{ bar: isBar }} />`,
68+
)
69+
expect(code).toMatchSnapshot()
70+
})
5771
})

0 commit comments

Comments
 (0)