@@ -31,17 +31,55 @@ describe('nesting', function () {
31
31
32
32
expect ( nano . putRaw . mock . calls [ 0 ] [ 0 ] . includes ( '.foo .one,.foo .two' ) ) . toBe ( true ) ;
33
33
} ) ;
34
- /*
35
- it('expands & operand after', () => {
36
- expect(interpolateSelectors(['.one', '#two'], '.test &')).toBe('.test .one,.test #two');
34
+
35
+ it ( 'expands & operand after' , function ( ) {
36
+ var nano = createNano ( ) ;
37
+
38
+ nano . putRaw = jest . fn ( ) ;
39
+
40
+ nano . put ( '.one, #two' , {
41
+ '.foo &' : {
42
+ color : 'tomato'
43
+ }
44
+ } ) ;
45
+
46
+ var result = nano . putRaw . mock . calls [ 0 ] [ 0 ] . replace ( / + (? = ) / g, '' ) ;
47
+
48
+ expect ( result . includes ( '.foo .one,.foo #two' ) ) . toBe ( true ) ;
37
49
} ) ;
38
50
39
- it('expands & operand before', () => {
40
- expect(interpolateSelectors(['.test'], '&:hover')).toBe('.test:hover');
51
+ it ( 'expands & operand before' , function ( ) {
52
+ var nano = createNano ( ) ;
53
+
54
+ nano . putRaw = jest . fn ( ) ;
55
+ nano . put ( '.foo' , {
56
+ '&:hover' : {
57
+ color : 'tomato'
58
+ } ,
59
+ '& .bar' : {
60
+ color : 'tomato'
61
+ } ,
62
+ } ) ;
63
+
64
+ var css1 = nano . putRaw . mock . calls [ 0 ] [ 0 ] . replace ( / + (? = ) / g, '' ) ;
65
+ var css2 = nano . putRaw . mock . calls [ 1 ] [ 0 ] . replace ( / + (? = ) / g, '' ) ;
66
+
67
+ expect ( css1 . includes ( '.foo:hover' ) ) . toBe ( true ) ;
68
+ expect ( css2 . includes ( '.foo .bar' ) ) . toBe ( true ) ;
41
69
} ) ;
42
70
43
- it('expands & operand before and preserves spaces', () => {
44
- expect(interpolateSelectors(['.one', '.two'], '& .test')).toBe('.one .test,.two .test');
71
+ it ( 'expands multiple & operands' , function ( ) {
72
+ var nano = createNano ( ) ;
73
+
74
+ nano . putRaw = jest . fn ( ) ;
75
+ nano . put ( '.foo' , {
76
+ '& + &' : {
77
+ color : 'tomato'
78
+ } ,
79
+ } ) ;
80
+
81
+ var css1 = nano . putRaw . mock . calls [ 0 ] [ 0 ] . replace ( / + (? = ) / g, '' ) ;
82
+
83
+ expect ( css1 . includes ( '.foo + .foo' ) ) . toBe ( true ) ;
45
84
} ) ;
46
- */
47
85
} ) ;
0 commit comments