@@ -34,159 +34,6 @@ describe('local', () => {
34
34
subClass : '_1s1VsToXFz17cPAltMg7jz' ,
35
35
}
36
36
) ;
37
- testLocal (
38
- 'mode switching' ,
39
- '.c1 :local .c2 .c3 :global .c4 :local .c5, .c6 :local .c7 { background: red; }\n.c8 { background: red; }' ,
40
- [
41
- [
42
- 1 ,
43
- '.c1 ._c2 ._c3 .c4 ._c5, .c6 ._c7 { background: red; }\n.c8 { background: red; }' ,
44
- '' ,
45
- ] ,
46
- ] ,
47
- {
48
- c2 : '_c2' ,
49
- c3 : '_c3' ,
50
- c5 : '_c5' ,
51
- c7 : '_c7' ,
52
- } ,
53
- '?localIdentName=_[local]'
54
- ) ;
55
- testLocal (
56
- 'comment in local' ,
57
- ':local(.c1/*.c2*/.c3) { background: red; }' ,
58
- [ [ 1 , '._c1/*.c2*/._c3 { background: red; }' , '' ] ] ,
59
- {
60
- c1 : '_c1' ,
61
- c3 : '_c3' ,
62
- } ,
63
- '?localIdentName=_[local]'
64
- ) ;
65
- testLocal (
66
- 'comment in local' ,
67
- ':local(.c1/*.c2*/.c3) { background: red; }' ,
68
- [ [ 1 , '._c1/*.c2*/._c3 { background: red; }' , '' ] ] ,
69
- {
70
- c1 : '_c1' ,
71
- c3 : '_c3' ,
72
- } ,
73
- '?localIdentName=_[local]'
74
- ) ;
75
- testLocal (
76
- 'strings in local' ,
77
- ':local(.c1[data-attr=".c2)]\'"]:not(.c3):not(.c4)) { background: red; }' ,
78
- [
79
- [
80
- 1 ,
81
- '._c1[data-attr=".c2)]\'"]:not(._c3):not(._c4) { background: red; }' ,
82
- '' ,
83
- ] ,
84
- ] ,
85
- {
86
- c1 : '_c1' ,
87
- c3 : '_c3' ,
88
- c4 : '_c4' ,
89
- } ,
90
- '?localIdentName=_[local]'
91
- ) ;
92
-
93
- testLocal (
94
- 'composes class simple' ,
95
- ':local(.c1) { a: 1; }\n:local(.c2) { composes: c1; b: 1; }' ,
96
- [ [ 1 , '._c1 { a: 1; }\n._c2 { b: 1; }' , '' ] ] ,
97
- {
98
- c1 : '_c1' ,
99
- c2 : '_c2 _c1' ,
100
- } ,
101
- '?localIdentName=_[local]'
102
- ) ;
103
- testLocal (
104
- 'composes class from module' ,
105
- [
106
- ':local(.c1) { composes: c2 from "./module"; b: 1; }' ,
107
- ':local(.c3) { composes: c1; b: 3; }' ,
108
- ':local(.c5) { composes: c2 c4 from "./module"; b: 5; }' ,
109
- ] . join ( '\n' ) ,
110
- [
111
- [ 2 , '.test{c: d}' , '' ] ,
112
- [
113
- 1 ,
114
- [ '._c1 { b: 1; }' , '._c3 { b: 3; }' , '._c5 { b: 5; }' ] . join ( '\n' ) ,
115
- '' ,
116
- ] ,
117
- ] ,
118
- {
119
- c1 : '_c1 imported-c2' ,
120
- c3 : '_c3 _c1 imported-c2' ,
121
- c5 : '_c5 imported-c2 imported-c4' ,
122
- } ,
123
- '?localIdentName=_[local]' ,
124
- {
125
- './module' : ( ( ) => {
126
- const r = [ [ 2 , '.test{c: d}' , '' ] ] ;
127
- r . locals = {
128
- c2 : 'imported-c2' ,
129
- c4 : 'imported-c4' ,
130
- } ;
131
- return r ;
132
- } ) ( ) ,
133
- }
134
- ) ;
135
- testLocal (
136
- 'composes class with hyphen from module' ,
137
- [
138
- ':local(.c1) { composes: c-2 from "./module"; b: 1; }' ,
139
- ':local(.c3) { composes: c1; b: 3; }' ,
140
- ':local(.c5) { composes: c-2 c4 from "./module"; b: 5; }' ,
141
- ] . join ( '\n' ) ,
142
- [
143
- [ 2 , '.test{c: d}' , '' ] ,
144
- [
145
- 1 ,
146
- [ '._c1 { b: 1; }' , '._c3 { b: 3; }' , '._c5 { b: 5; }' ] . join ( '\n' ) ,
147
- '' ,
148
- ] ,
149
- ] ,
150
- {
151
- c1 : '_c1 imported-c-2' ,
152
- c3 : '_c3 _c1 imported-c-2' ,
153
- c5 : '_c5 imported-c-2 imported-c4' ,
154
- } ,
155
- '?localIdentName=_[local]' ,
156
- {
157
- './module' : ( ( ) => {
158
- const r = [ [ 2 , '.test{c: d}' , '' ] ] ;
159
- r . locals = {
160
- 'c-2' : 'imported-c-2' ,
161
- c4 : 'imported-c4' ,
162
- } ;
163
- return r ;
164
- } ) ( ) ,
165
- }
166
- ) ;
167
- testLocal (
168
- 'composes class from module with import' ,
169
- [
170
- '@import url("module");' ,
171
- ':local(.c1) { composes: c2 c3 from "./module"; composes: c4 from "./module"; b: 1; }' ,
172
- ] . join ( '\n' ) ,
173
- [ [ 2 , '.test{c: d}' , '' ] , [ 1 , '._c1 { b: 1; }' , '' ] ] ,
174
- {
175
- c1 : '_c1 imported-c2 imported-c3 imported-c4' ,
176
- } ,
177
- '?localIdentName=_[local]' ,
178
- {
179
- './module' : ( ( ) => {
180
- const r = [ [ 2 , '.test{c: d}' , '' ] ] ;
181
- r . locals = {
182
- c2 : 'imported-c2' ,
183
- c3 : 'imported-c3' ,
184
- c4 : 'imported-c4' ,
185
- } ;
186
- return r ;
187
- } ) ( ) ,
188
- }
189
- ) ;
190
37
testLocal (
191
38
'module mode' ,
192
39
".className { background: url(./file.png); }\n#someId { background: url('module/file.jpg'); }\n" +
0 commit comments