@@ -21,46 +21,62 @@ describe('api', () => {
21
21
22
22
it ( 'should toString a single module' , ( ) => {
23
23
const m = api ( ) ;
24
+
24
25
m . push ( [ 1 , 'body { a: 1; }' , '' ] ) ;
26
+
25
27
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
26
28
} ) ;
29
+
27
30
it ( 'should toString multiple modules' , ( ) => {
28
31
const m = api ( ) ;
32
+
29
33
m . push ( [ 2 , 'body { b: 2; }' , '' ] ) ;
30
34
m . push ( [ 1 , 'body { a: 1; }' , '' ] ) ;
35
+
31
36
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
32
37
} ) ;
38
+
33
39
it ( 'should toString with media query' , ( ) => {
34
40
const m = api ( ) ;
41
+
35
42
m . push ( [ 1 , 'body { a: 1; }' , 'screen' ] ) ;
43
+
36
44
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
37
45
} ) ;
46
+
38
47
it ( 'should import modules' , ( ) => {
39
48
const m = api ( ) ;
40
49
const m1 = [ 1 , 'body { a: 1; }' , 'screen' ] ;
41
50
const m2 = [ 2 , 'body { b: 2; }' , '' ] ;
42
51
const m3 = [ 3 , 'body { c: 3; }' , '' ] ;
43
52
const m4 = [ 4 , 'body { d: 4; }' , '' ] ;
53
+
44
54
m . i ( [ m2 , m3 ] , '' ) ;
45
55
m . i ( [ m2 ] , '' ) ;
46
56
m . i ( [ m2 , m4 ] , 'print' ) ;
47
57
m . push ( m1 ) ;
58
+
48
59
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
49
60
} ) ;
61
+
50
62
it ( 'should import named modules' , ( ) => {
51
63
const m = api ( ) ;
52
64
const m1 = [ './module1' , 'body { a: 1; }' , 'screen' ] ;
53
65
const m2 = [ './module2' , 'body { b: 2; }' , '' ] ;
54
66
const m3 = [ './module3' , 'body { c: 3; }' , '' ] ;
55
67
const m4 = [ './module4' , 'body { d: 4; }' , '' ] ;
68
+
56
69
m . i ( [ m2 , m3 ] , '' ) ;
57
70
m . i ( [ m2 ] , '' ) ;
58
71
m . i ( [ m2 , m4 ] , 'print' ) ;
59
72
m . push ( m1 ) ;
73
+
60
74
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
61
75
} ) ;
76
+
62
77
it ( 'should toString with source mapping' , ( ) => {
63
78
const m = api ( true ) ;
79
+
64
80
m . push ( [
65
81
1 ,
66
82
'body { a: 1; }' ,
@@ -72,11 +88,15 @@ describe('api', () => {
72
88
sourceRoot : 'webpack://' ,
73
89
} ,
74
90
] ) ;
91
+
75
92
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
76
93
} ) ;
94
+
77
95
it ( 'should toString without source mapping if btoa not avalibale' , ( ) => {
78
96
global . btoa = null ;
97
+
79
98
const m = api ( true ) ;
99
+
80
100
m . push ( [
81
101
1 ,
82
102
'body { a: 1; }' ,
@@ -88,6 +108,7 @@ describe('api', () => {
88
108
sourceRoot : 'webpack://' ,
89
109
} ,
90
110
] ) ;
111
+
91
112
expect ( m . toString ( ) ) . toMatchSnapshot ( ) ;
92
113
} ) ;
93
114
} ) ;
0 commit comments