1
1
/*globals describe */
2
2
3
3
var test = require ( "./helpers" ) . test ;
4
+ var testMinimize = require ( "./helpers" ) . testMinimize ;
4
5
5
6
function testLocal ( name , input , result , localsResult , query , modules ) {
6
7
result . locals = localsResult ;
7
8
test ( name , input , result , query , modules ) ;
8
9
}
9
10
11
+ function testLocalMinimize ( name , input , result , localsResult , query , modules ) {
12
+ result . locals = localsResult ;
13
+ testMinimize ( name , input , result , query , modules ) ;
14
+ }
15
+
10
16
describe ( "local" , function ( ) {
11
17
testLocal ( "locals-format" , ":local(.test) { background: red; }" , [
12
18
[ 1 , ".test-3tNsp { background: red; }" , "" ]
@@ -22,6 +28,13 @@ describe("local", function() {
22
28
someId : "_1j3LM6lKkKzRIt19ImYVnD" ,
23
29
subClass : "_13LGdX8RMStbBE9w-t0gZ1"
24
30
} ) ;
31
+ testLocalMinimize ( "minimized plus local" , ":local(.localClass) { background: red; }\n:local .otherClass { background: red; }\n:local(.empty) { }" , [
32
+ [ 1 , "._localClass,._otherClass{background:red}" , "" ]
33
+ ] , {
34
+ localClass : "_localClass" ,
35
+ otherClass : "_otherClass" ,
36
+ empty : "_empty"
37
+ } , "?localIdentName=_[local]" ) ;
25
38
testLocal ( "mode switching" , ".c1 :local .c2 .c3 :global .c4 :local .c5, .c6 :local .c7 { background: red; }\n.c8 { background: red; }" , [
26
39
[ 1 , ".c1 ._c2 ._c3 .c4 ._c5, .c6 ._c7 { background: red; }\n.c8 { background: red; }" , "" ]
27
40
] , {
0 commit comments