@@ -15,18 +15,18 @@ function testLocalMinimize(name, input, result, localsResult, query, modules) {
1515
1616describe ( "local" , function ( ) {
1717testLocal ( "locals-format" , ":local(.test) { background: red; }" , [
18- [ 1 , ".test-3tNsp { background: red; }" , "" ]
18+ [ 1 , ".test-2_pBx { background: red; }" , "" ]
1919] , {
20- test : "test-3tNsp "
20+ test : "test-2_pBx "
2121} , "?localIdentName=[local]-[hash:base64:5]" ) ;
2222testLocal ( "locals" , ":local(.className) { background: red; }\n:local(#someId) { background: green; }\n" +
2323":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; }" , "" ]
2626] , {
27- className : "_23_aKvs-b8bW2Vg3fwHozO " ,
28- someId : "_1j3LM6lKkKzRIt19ImYVnD " ,
29- subClass : "_13LGdX8RMStbBE9w-t0gZ1 "
27+ className : "_23J0282swY7bwvI2X4fHiV " ,
28+ someId : "_3vpqN0v_IxlO3TzQjbpB33 " ,
29+ subClass : "_1s1VsToXFz17cPAltMg7jz "
3030} ) ;
3131testLocalMinimize ( "minimized plus local" , ":local(.localClass) { background: red; }\n:local .otherClass { background: red; }\n:local(.empty) { }" , [
3232[ 1 , "._localClass,._otherClass{background:red}" , "" ]
@@ -146,17 +146,17 @@ describe("local", function() {
146146} ) ;
147147testLocal ( "module mode" , ".className { background: url(./file.png); }\n#someId { background: url('module/file.jpg'); }\n" +
148148".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; }" , "" ]
151151] , {
152- className : "_23_aKvs-b8bW2Vg3fwHozO " ,
153- someId : "_1j3LM6lKkKzRIt19ImYVnD " ,
154- subClass : "_13LGdX8RMStbBE9w-t0gZ1 "
152+ className : "_23J0282swY7bwvI2X4fHiV " ,
153+ someId : "_3vpqN0v_IxlO3TzQjbpB33 " ,
154+ subClass : "_1s1VsToXFz17cPAltMg7jz "
155155} , "?module" ) ;
156156testLocal ( "class name parsing" , ".-a0-34a___f { color: red; }" , [
157- [ 1 , "._1YJOcrkc6cyZmBAAvyPFOn { color: red; }" , "" ]
157+ [ 1 , "._3ZMCqVa1XidxdqbX65hZ5D { color: red; }" , "" ]
158158] , {
159- "-a0-34a___f" : "_1YJOcrkc6cyZmBAAvyPFOn "
159+ "-a0-34a___f" : "_3ZMCqVa1XidxdqbX65hZ5D "
160160} , "?module" ) ;
161161testLocal ( "imported values in decl" , ".className { color: IMPORTED_NAME; }\n" +
162162":import(\"./vars.css\") { IMPORTED_NAME: primary-color; }" , [
@@ -171,8 +171,35 @@ describe("local", function() {
171171}
172172} ) ;
173173testLocal ( "issue-109" , ".bar-1 { color: red; }" , [
174- [ 1 , ".file--bar-1--2ESB7 { color: red; }" , "" ]
174+ [ 1 , ".file--bar-1--2JvfJ { color: red; }" , "" ]
175175] , {
176- "bar-1" : "file--bar-1--2ESB7 "
176+ "bar-1" : "file--bar-1--2JvfJ "
177177} , "?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" ) ;
178205} ) ;
0 commit comments