@@ -15,18 +15,18 @@ function testLocalMinimize(name, input, result, localsResult, query, modules) {
15
15
16
16
describe ( "local" , function ( ) {
17
17
testLocal ( "locals-format" , ":local(.test) { background: red; }" , [
18
- [ 1 , ".test-3tNsp { background: red; }" , "" ]
18
+ [ 1 , ".test-2_pBx { background: red; }" , "" ]
19
19
] , {
20
- test : "test-3tNsp "
20
+ test : "test-2_pBx "
21
21
} , "?localIdentName=[local]-[hash:base64:5]" ) ;
22
22
testLocal ( "locals" , ":local(.className) { background: red; }\n:local(#someId) { background: green; }\n" +
23
23
":local(.className .subClass) { color: green; }\n:local(#someId .subClass) { color: blue; }" , [
24
- [ 1 , "._23_aKvs-b8bW2Vg3fwHozO { background: red; }\n#_1j3LM6lKkKzRIt19ImYVnD { background: green; }\n" +
25
- "._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 { color: green; }\n#_1j3LM6lKkKzRIt19ImYVnD ._13LGdX8RMStbBE9w-t0gZ1 { color: blue; }" , "" ]
24
+ [ 1 , "._23J0282swY7bwvI2X4fHiV { background: red; }\n#_3vpqN0v_IxlO3TzQjbpB33 { background: green; }\n" +
25
+ "._23J0282swY7bwvI2X4fHiV ._1s1VsToXFz17cPAltMg7jz { color: green; }\n#_3vpqN0v_IxlO3TzQjbpB33 ._1s1VsToXFz17cPAltMg7jz { color: blue; }" , "" ]
26
26
] , {
27
- className : "_23_aKvs-b8bW2Vg3fwHozO " ,
28
- someId : "_1j3LM6lKkKzRIt19ImYVnD " ,
29
- subClass : "_13LGdX8RMStbBE9w-t0gZ1 "
27
+ className : "_23J0282swY7bwvI2X4fHiV " ,
28
+ someId : "_3vpqN0v_IxlO3TzQjbpB33 " ,
29
+ subClass : "_1s1VsToXFz17cPAltMg7jz "
30
30
} ) ;
31
31
testLocalMinimize ( "minimized plus local" , ":local(.localClass) { background: red; }\n:local .otherClass { background: red; }\n:local(.empty) { }" , [
32
32
[ 1 , "._localClass,._otherClass{background:red}" , "" ]
@@ -146,17 +146,17 @@ describe("local", function() {
146
146
} ) ;
147
147
testLocal ( "module mode" , ".className { background: url(./file.png); }\n#someId { background: url('module/file.jpg'); }\n" +
148
148
".className .subClass { font-size: 5.5pt; }\n#someId .subClass { color: blue; }" , [
149
- [ 1 , "._23_aKvs-b8bW2Vg3fwHozO { background: url({./file.png}); }\n#_1j3LM6lKkKzRIt19ImYVnD { background: url({module/file.jpg}); }\n" +
150
- "._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 { font-size: 5.5pt; }\n#_1j3LM6lKkKzRIt19ImYVnD ._13LGdX8RMStbBE9w-t0gZ1 { color: blue; }" , "" ]
149
+ [ 1 , "._23J0282swY7bwvI2X4fHiV { background: url({./file.png}); }\n#_3vpqN0v_IxlO3TzQjbpB33 { background: url({module/file.jpg}); }\n" +
150
+ "._23J0282swY7bwvI2X4fHiV ._1s1VsToXFz17cPAltMg7jz { font-size: 5.5pt; }\n#_3vpqN0v_IxlO3TzQjbpB33 ._1s1VsToXFz17cPAltMg7jz { color: blue; }" , "" ]
151
151
] , {
152
- className : "_23_aKvs-b8bW2Vg3fwHozO " ,
153
- someId : "_1j3LM6lKkKzRIt19ImYVnD " ,
154
- subClass : "_13LGdX8RMStbBE9w-t0gZ1 "
152
+ className : "_23J0282swY7bwvI2X4fHiV " ,
153
+ someId : "_3vpqN0v_IxlO3TzQjbpB33 " ,
154
+ subClass : "_1s1VsToXFz17cPAltMg7jz "
155
155
} , "?module" ) ;
156
156
testLocal ( "class name parsing" , ".-a0-34a___f { color: red; }" , [
157
- [ 1 , "._1YJOcrkc6cyZmBAAvyPFOn { color: red; }" , "" ]
157
+ [ 1 , "._3ZMCqVa1XidxdqbX65hZ5D { color: red; }" , "" ]
158
158
] , {
159
- "-a0-34a___f" : "_1YJOcrkc6cyZmBAAvyPFOn "
159
+ "-a0-34a___f" : "_3ZMCqVa1XidxdqbX65hZ5D "
160
160
} , "?module" ) ;
161
161
testLocal ( "imported values in decl" , ".className { color: IMPORTED_NAME; }\n" +
162
162
":import(\"./vars.css\") { IMPORTED_NAME: primary-color; }" , [
@@ -171,8 +171,35 @@ describe("local", function() {
171
171
}
172
172
} ) ;
173
173
testLocal ( "issue-109" , ".bar-1 { color: red; }" , [
174
- [ 1 , ".file--bar-1--2ESB7 { color: red; }" , "" ]
174
+ [ 1 , ".file--bar-1--2JvfJ { color: red; }" , "" ]
175
175
] , {
176
- "bar-1" : "file--bar-1--2ESB7 "
176
+ "bar-1" : "file--bar-1--2JvfJ "
177
177
} , "?modules&importLoaders=1&localIdentName=[name]--[local]--[hash:base64:5]" ) ;
178
+ testLocal ( "path naming" , ".bar { color: red; }" , [
179
+ [ 1 , ".path-to--file--bar { color: red; }" , "" ]
180
+ ] , {
181
+ "bar" : "path-to--file--bar"
182
+ } , {
183
+ query : "?modules&localIdentName=[path]-[name]--[local]" ,
184
+ resourcePath : "/root/path/to/file.css" ,
185
+ options : {
186
+ context : "/root/"
187
+ }
188
+ } ) ;
189
+ testLocal ( "path naming with context" , ".bar { color: red; }" , [
190
+ [ 1 , ".to--file--bar { color: red; }" , "" ]
191
+ ] , {
192
+ "bar" : "to--file--bar"
193
+ } , {
194
+ query : "?modules&localIdentName=[path]-[name]--[local]&context=/root/path" ,
195
+ resourcePath : "/root/path/to/file.css" ,
196
+ options : {
197
+ context : "/root/"
198
+ }
199
+ } ) ;
200
+ testLocal ( "hash prefix" , ".bar { color: red; }" , [
201
+ [ 1 , ".bar--58a3b08b9195a6af0de7431eaf3427c7 { color: red; }" , "" ]
202
+ ] , {
203
+ "bar" : "bar--58a3b08b9195a6af0de7431eaf3427c7"
204
+ } , "?modules&localIdentName=[local]--[hash]&hashPrefix=x" ) ;
178
205
} ) ;
0 commit comments