@@ -55,52 +55,73 @@ describe('SFC scoped CSS', () => {
55
55
} )
56
56
57
57
test ( '::v-deep' , ( ) => {
58
- expect ( compile ( `::v-deep(.foo) { color: red; }` ) ) . toMatch (
59
- `[test] .foo { color: red;`
60
- )
61
- expect ( compile ( `::v-deep(.foo .bar) { color: red; }` ) ) . toMatch (
62
- `[test] .foo .bar { color: red;`
63
- )
64
- expect ( compile ( `.baz .qux ::v-deep(.foo .bar) { color: red; }` ) ) . toMatch (
65
- `.baz .qux[test] .foo .bar { color: red;`
66
- )
58
+ expect ( compile ( `::v-deep(.foo) { color: red; }` ) ) . toMatchInlineSnapshot ( `
59
+ "[test] .foo { color: red;
60
+ }"
61
+ ` )
62
+ expect ( compile ( `::v-deep(.foo .bar) { color: red; }` ) )
63
+ . toMatchInlineSnapshot ( `
64
+ "[test] .foo .bar { color: red;
65
+ }"
66
+ ` )
67
+ expect ( compile ( `.baz .qux ::v-deep(.foo .bar) { color: red; }` ) )
68
+ . toMatchInlineSnapshot ( `
69
+ ".baz .qux[test] .foo .bar { color: red;
70
+ }"
71
+ ` )
67
72
} )
68
73
69
74
test ( '::v-slotted' , ( ) => {
70
- expect ( compile ( `::v-slotted(.foo) { color: red; }` ) ) . toMatch (
71
- `.foo[test-s] { color: red;`
72
- )
73
- expect ( compile ( `::v-slotted(.foo .bar) { color: red; }` ) ) . toMatch (
74
- `.foo .bar[test-s] { color: red;`
75
- )
76
- expect ( compile ( `.baz .qux ::v-slotted(.foo .bar) { color: red; }` ) ) . toMatch (
77
- `.baz .qux[test] .foo .bar[test-s] { color: red;`
78
- )
75
+ expect ( compile ( `::v-slotted(.foo) { color: red; }` ) ) . toMatchInlineSnapshot ( `
76
+ ".foo[test-s] { color: red;
77
+ }"
78
+ ` )
79
+ expect ( compile ( `::v-slotted(.foo .bar) { color: red; }` ) )
80
+ . toMatchInlineSnapshot ( `
81
+ ".foo .bar[test-s] { color: red;
82
+ }"
83
+ ` )
84
+ expect ( compile ( `.baz .qux ::v-slotted(.foo .bar) { color: red; }` ) )
85
+ . toMatchInlineSnapshot ( `
86
+ ".baz .qux .foo .bar[test-s] { color: red;
87
+ }"
88
+ ` )
79
89
} )
80
90
81
91
test ( '::v-global' , ( ) => {
82
- expect ( compile ( `::v-global(.foo) { color: red; }` ) ) . toMatch (
83
- `.foo { color: red;`
84
- )
85
- expect ( compile ( `::v-global(.foo .bar) { color: red; }` ) ) . toMatch (
86
- `.foo .bar { color: red;`
87
- )
92
+ expect ( compile ( `::v-global(.foo) { color: red; }` ) ) . toMatchInlineSnapshot ( `
93
+ ".foo { color: red;
94
+ }"
95
+ ` )
96
+ expect ( compile ( `::v-global(.foo .bar) { color: red; }` ) )
97
+ . toMatchInlineSnapshot ( `
98
+ ".foo .bar { color: red;
99
+ }"
100
+ ` )
88
101
// global ignores anything before it
89
- expect ( compile ( `.baz .qux ::v-global(.foo .bar) { color: red; }` ) ) . toMatch (
90
- `.foo .bar { color: red;`
91
- )
102
+ expect ( compile ( `.baz .qux ::v-global(.foo .bar) { color: red; }` ) )
103
+ . toMatchInlineSnapshot ( `
104
+ ".foo .bar { color: red;
105
+ }"
106
+ ` )
92
107
} )
93
108
94
109
test ( 'media query' , ( ) => {
95
- expect ( compile ( `@media print { .foo { color: red }}` ) ) . toMatch (
96
- / @ m e d i a p r i n t { \s + \. f o o \[ t e s t \] \{ c o l o r : r e d /
97
- )
110
+ expect ( compile ( `@media print { .foo { color: red }}` ) )
111
+ . toMatchInlineSnapshot ( `
112
+ "@media print {
113
+ .foo[test] { color: red
114
+ }}"
115
+ ` )
98
116
} )
99
117
100
118
test ( 'supports query' , ( ) => {
101
- expect (
102
- compile ( `@supports(display: grid) { .foo { display: grid }}` )
103
- ) . toMatch ( / @ s u p p o r t s \( d i s p l a y : g r i d \) { \s + \. f o o \[ t e s t \] \{ d i s p l a y : g r i d / )
119
+ expect ( compile ( `@supports(display: grid) { .foo { display: grid }}` ) )
120
+ . toMatchInlineSnapshot ( `
121
+ "@supports(display: grid) {
122
+ .foo[test] { display: grid
123
+ }}"
124
+ ` )
104
125
} )
105
126
106
127
test ( 'scoped keyframes' , ( ) => {
@@ -169,33 +190,45 @@ describe('SFC scoped CSS', () => {
169
190
id : 'test'
170
191
} )
171
192
172
- expect ( code ) . toMatch ( `.foo[test], .bar[test] { color: red;` )
193
+ expect ( code ) . toMatchInlineSnapshot ( `
194
+ ".foo[test], .bar[test] { color: red;
195
+ }"
196
+ ` )
173
197
} )
174
198
175
199
describe ( 'deprecated syntax' , ( ) => {
176
200
test ( '::v-deep as combinator' , ( ) => {
177
- expect ( compile ( `::v-deep .foo { color: red; }` ) ) . toMatch (
178
- `[test] .foo { color: red;`
179
- )
180
- expect ( compile ( `.bar ::v-deep .foo { color: red; }` ) ) . toMatch (
181
- `.bar[test] .foo { color: red;`
182
- )
201
+ expect ( compile ( `::v-deep .foo { color: red; }` ) ) . toMatchInlineSnapshot ( `
202
+ "[test] .foo { color: red;
203
+ }"
204
+ ` )
205
+ expect ( compile ( `.bar ::v-deep .foo { color: red; }` ) )
206
+ . toMatchInlineSnapshot ( `
207
+ ".bar[test] .foo { color: red;
208
+ }"
209
+ ` )
183
210
expect (
184
211
`::v-deep usage as a combinator has been deprecated.`
185
212
) . toHaveBeenWarned ( )
186
213
} )
187
214
188
215
test ( '>>> (deprecated syntax)' , ( ) => {
189
216
const code = compile ( `>>> .foo { color: red; }` )
190
- expect ( code ) . toMatch ( `[test] .foo { color: red;` )
217
+ expect ( code ) . toMatchInlineSnapshot ( `
218
+ "[test] .foo { color: red;
219
+ }"
220
+ ` )
191
221
expect (
192
222
`the >>> and /deep/ combinators have been deprecated.`
193
223
) . toHaveBeenWarned ( )
194
224
} )
195
225
196
226
test ( '/deep/ (deprecated syntax)' , ( ) => {
197
227
const code = compile ( `/deep/ .foo { color: red; }` )
198
- expect ( code ) . toMatch ( `[test] .foo { color: red;` )
228
+ expect ( code ) . toMatchInlineSnapshot ( `
229
+ "[test] .foo { color: red;
230
+ }"
231
+ ` )
199
232
expect (
200
233
`the >>> and /deep/ combinators have been deprecated.`
201
234
) . toHaveBeenWarned ( )
0 commit comments