@@ -32,10 +32,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
32
32
} ) ;
33
33
34
34
await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
35
- content . replace (
36
- '__STYLE_MARKER__' ,
37
- '$primary-color: green;\\nh1 { color: $primary-color; }' ,
38
- ) ,
35
+ content . replace ( '__STYLE_MARKER__' , '$primary: green;\\nh1 { color: $primary; }' ) ,
39
36
) ;
40
37
41
38
const { result } = await harness . executeOnce ( ) ;
@@ -52,10 +49,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
52
49
} ) ;
53
50
54
51
await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
55
- content . replace (
56
- '__STYLE_MARKER__' ,
57
- '$primary-color: green\\nh1\\n\\tcolor: $primary-color' ,
58
- ) ,
52
+ content . replace ( '__STYLE_MARKER__' , '$primary: green\\nh1\\n\\tcolor: $primary' ) ,
59
53
) ;
60
54
61
55
const { result } = await harness . executeOnce ( ) ;
@@ -77,7 +71,7 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
77
71
// await harness.modifyFile('src/app/app.component.ts', (content) =>
78
72
// content.replace(
79
73
// '__STYLE_MARKER__',
80
- // '$primary-color = green;\\nh1 { color: $primary-color ; }',
74
+ // '$primary = green;\\nh1 { color: $primary; }',
81
75
// ),
82
76
// );
83
77
@@ -95,78 +89,72 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
95
89
} ) ;
96
90
97
91
await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
98
- content . replace (
99
- '__STYLE_MARKER__' ,
100
- '@primary-color: green;\\nh1 { color: @primary-color; }' ,
101
- ) ,
92
+ content . replace ( '__STYLE_MARKER__' , '@primary: green;\\nh1 { color: @primary; }' ) ,
102
93
) ;
103
94
104
95
const { result } = await harness . executeOnce ( ) ;
105
96
106
97
expect ( result ?. success ) . toBe ( true ) ;
107
98
harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: green' ) ;
108
99
} ) ;
109
- } ) ;
110
100
111
- it ( 'updates produced stylesheet in watch mode' , async ( ) => {
112
- harness . useTarget ( 'build' , {
113
- ...BASE_OPTIONS ,
114
- main : 'src/main.ts' ,
115
- inlineStyleLanguage : InlineStyleLanguage . Scss ,
116
- aot,
117
- watch : true ,
118
- } ) ;
101
+ it ( 'updates produced stylesheet in watch mode' , async ( ) => {
102
+ harness . useTarget ( 'build' , {
103
+ ...BASE_OPTIONS ,
104
+ main : 'src/main.ts' ,
105
+ inlineStyleLanguage : InlineStyleLanguage . Scss ,
106
+ aot,
107
+ watch : true ,
108
+ } ) ;
119
109
120
- await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
121
- content . replace (
122
- '__STYLE_MARKER__' ,
123
- '$primary-color: green;\\nh1 { color: $primary-color; }' ,
124
- ) ,
125
- ) ;
126
-
127
- const buildCount = await harness
128
- . execute ( )
129
- . pipe (
130
- timeout ( 30000 ) ,
131
- concatMap ( async ( { result } , index ) => {
132
- expect ( result ?. success ) . toBe ( true ) ;
133
-
134
- switch ( index ) {
135
- case 0 :
136
- harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: green' ) ;
137
- harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: aqua' ) ;
138
-
139
- await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
140
- content . replace (
141
- '$primary-color: green;\\nh1 { color: $primary-color; }' ,
142
- '$primary-color: aqua;\\nh1 { color: $primary-color; }' ,
143
- ) ,
144
- ) ;
145
- break ;
146
- case 1 :
147
- harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: green' ) ;
148
- harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: aqua' ) ;
149
-
150
- await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
151
- content . replace (
152
- '$primary-color: aqua;\\nh1 { color: $primary-color; }' ,
153
- '$primary-color: blue;\\nh1 { color: $primary-color; }' ,
154
- ) ,
155
- ) ;
156
- break ;
157
- case 2 :
158
- harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: green' ) ;
159
- harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: aqua' ) ;
160
- harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: blue' ) ;
161
- break ;
162
- }
163
- } ) ,
164
- take ( 3 ) ,
165
- count ( ) ,
166
- )
167
- . toPromise ( ) ;
168
-
169
- expect ( buildCount ) . toBe ( 3 ) ;
110
+ await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
111
+ content . replace ( '__STYLE_MARKER__' , '$primary: green;\\nh1 { color: $primary; }' ) ,
112
+ ) ;
113
+
114
+ const buildCount = await harness
115
+ . execute ( )
116
+ . pipe (
117
+ timeout ( 30000 ) ,
118
+ concatMap ( async ( { result } , index ) => {
119
+ expect ( result ?. success ) . toBe ( true ) ;
120
+
121
+ switch ( index ) {
122
+ case 0 :
123
+ harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: green' ) ;
124
+ harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: aqua' ) ;
125
+
126
+ await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
127
+ content . replace (
128
+ '$primary: green;\\nh1 { color: $primary; }' ,
129
+ '$primary: aqua;\\nh1 { color: $primary; }' ,
130
+ ) ,
131
+ ) ;
132
+ break ;
133
+ case 1 :
134
+ harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: green' ) ;
135
+ harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: aqua' ) ;
136
+
137
+ await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) =>
138
+ content . replace (
139
+ '$primary: aqua;\\nh1 { color: $primary; }' ,
140
+ '$primary: blue;\\nh1 { color: $primary; }' ,
141
+ ) ,
142
+ ) ;
143
+ break ;
144
+ case 2 :
145
+ harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: green' ) ;
146
+ harness . expectFile ( 'dist/main.js' ) . content . not . toContain ( 'color: aqua' ) ;
147
+ harness . expectFile ( 'dist/main.js' ) . content . toContain ( 'color: blue' ) ;
148
+ break ;
149
+ }
150
+ } ) ,
151
+ take ( 3 ) ,
152
+ count ( ) ,
153
+ )
154
+ . toPromise ( ) ;
155
+
156
+ expect ( buildCount ) . toBe ( 3 ) ;
157
+ } ) ;
170
158
} ) ;
171
159
}
172
160
} ) ;
0 commit comments