@@ -200,5 +200,60 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
200200
201201 harness . expectFile ( 'dist/browser/main.js' ) . content . toMatch ( / { \\ n \s * h y p h e n s : \s * n o n e ; \\ n \s * } / ) ;
202202 } ) ;
203+
204+ it ( 'should add prefixes for listed browsers in inline template styles' , async ( ) => {
205+ await harness . writeFile (
206+ '.browserslistrc' ,
207+ `
208+ Safari 15.4
209+ Edge 104
210+ Firefox 91
211+ ` ,
212+ ) ;
213+
214+ await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) => {
215+ return content . replace ( 'styleUrls' , 'styles' ) . replace ( './app.component.css' , '' ) ;
216+ } ) ;
217+ await harness . modifyFile ( 'src/app/app.component.html' , ( content ) => {
218+ return `<style>aside { hyphens: none; }</style>\n${ content } ` ;
219+ } ) ;
220+
221+ harness . useTarget ( 'build' , {
222+ ...BASE_OPTIONS ,
223+ } ) ;
224+
225+ const { result } = await harness . executeOnce ( ) ;
226+ expect ( result ?. success ) . toBeTrue ( ) ;
227+
228+ harness
229+ . expectFile ( 'dist/browser/main.js' )
230+ // div[_ngcontent-%COMP%] {\n -webkit-hyphens: none;\n hyphens: none;\n}\n
231+ . content . toMatch ( / { \\ n \s * - w e b k i t - h y p h e n s : \s * n o n e ; \\ n \s * h y p h e n s : \s * n o n e ; \\ n \s * } / ) ;
232+ } ) ;
233+
234+ it ( 'should not add prefixes if not required by browsers in inline template styles' , async ( ) => {
235+ await harness . writeFile (
236+ '.browserslistrc' ,
237+ `
238+ Edge 110
239+ ` ,
240+ ) ;
241+
242+ await harness . modifyFile ( 'src/app/app.component.ts' , ( content ) => {
243+ return content . replace ( 'styleUrls' , 'styles' ) . replace ( './app.component.css' , '' ) ;
244+ } ) ;
245+ await harness . modifyFile ( 'src/app/app.component.html' , ( content ) => {
246+ return `<style>aside { hyphens: none; }</style>\n${ content } ` ;
247+ } ) ;
248+
249+ harness . useTarget ( 'build' , {
250+ ...BASE_OPTIONS ,
251+ } ) ;
252+
253+ const { result } = await harness . executeOnce ( ) ;
254+ expect ( result ?. success ) . toBeTrue ( ) ;
255+
256+ harness . expectFile ( 'dist/browser/main.js' ) . content . toMatch ( / { \\ n \s * h y p h e n s : \s * n o n e ; \\ n \s * } / ) ;
257+ } ) ;
203258 } ) ;
204259} ) ;
0 commit comments