Skip to content

Commit 98dd492

Browse files
authored
test: added pre process css unit test (#5)
1 parent 8899cfd commit 98dd492

File tree

10 files changed

+483
-18
lines changed

10 files changed

+483
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"prepare": "npx simple-git-hooks",
5959
"test": "vitest",
6060
"test:update": "vitest -u",
61-
"test:coverage": "vitest --coverageu"
61+
"test:coverage": "vitest --coverage"
6262
},
6363
"peerDependencies": {
6464
"chalk": "^5.2.0",
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`pre process css > getCSSVarsCode: generate code 1`] = `
4+
{
5+
"vBindCode": {
6+
"color": Set {
7+
"
8+
/* created by @unplugin-vue-cssvars */
9+
/* <inject start> */
10+
div{color:v-bind(color)}
11+
/* <inject end> */
12+
",
13+
},
14+
},
15+
"vBindEntry": false,
16+
"vBindPathNode": {
17+
"block": {
18+
"children": [
19+
{
20+
"important": false,
21+
"loc": null,
22+
"property": "color",
23+
"type": "Declaration",
24+
"value": {
25+
"children": [
26+
{
27+
"children": [
28+
{
29+
"loc": null,
30+
"name": "color",
31+
"type": "Identifier",
32+
},
33+
],
34+
"loc": null,
35+
"name": "v-bind",
36+
"type": "Function",
37+
},
38+
],
39+
"loc": null,
40+
"type": "Value",
41+
},
42+
},
43+
],
44+
"loc": null,
45+
"type": "Block",
46+
},
47+
"loc": null,
48+
"prelude": {
49+
"children": [
50+
{
51+
"children": [
52+
{
53+
"loc": null,
54+
"name": "div",
55+
"type": "TypeSelector",
56+
},
57+
],
58+
"loc": null,
59+
"type": "Selector",
60+
},
61+
],
62+
"loc": null,
63+
"type": "SelectorList",
64+
},
65+
"type": "Rule",
66+
},
67+
}
68+
`;
69+
70+
exports[`pre process css > preProcessCSS: basic 1`] = `
71+
{
72+
"color": Set {
73+
"
74+
/* created by @unplugin-vue-cssvars */
75+
/* <inject start> */
76+
div{color:v-bind(color)}
77+
/* <inject end> */
78+
",
79+
},
80+
}
81+
`;
82+
83+
exports[`pre process css > preProcessCSS: basic 2`] = `
84+
{
85+
"appTheme2": Set {
86+
"
87+
/* created by @unplugin-vue-cssvars */
88+
/* <inject start> */
89+
.test{color:v-bind(appTheme2)}
90+
/* <inject end> */
91+
",
92+
},
93+
}
94+
`;
95+
96+
exports[`pre process css > walkCSSTree: basic 1`] = `
97+
{
98+
"importer": "./test",
99+
"vBindCode": {
100+
"bar": Set {
101+
"
102+
/* created by @unplugin-vue-cssvars */
103+
/* <inject start> */
104+
.bar{color:v-bind(bar);font-size:22px}
105+
/* <inject end> */
106+
",
107+
},
108+
"color": Set {
109+
"
110+
/* created by @unplugin-vue-cssvars */
111+
/* <inject start> */
112+
.foo{color:v-bind(color);font-size:20px}
113+
/* <inject end> */
114+
",
115+
},
116+
},
117+
}
118+
`;
119+
120+
exports[`pre process css > walkCSSTree: helper i is false 1`] = `
121+
{
122+
"importer": "",
123+
"vBindCode": {
124+
"bar": Set {
125+
"
126+
/* created by @unplugin-vue-cssvars */
127+
/* <inject start> */
128+
.bar{color:v-bind(bar);font-size:22px}
129+
/* <inject end> */
130+
",
131+
},
132+
"color": Set {
133+
"
134+
/* created by @unplugin-vue-cssvars */
135+
/* <inject start> */
136+
.foo{color:v-bind(color);font-size:20px}
137+
/* <inject end> */
138+
",
139+
},
140+
},
141+
}
142+
`;

0 commit comments

Comments
 (0)