@@ -316,120 +316,93 @@ describe('Basic end-to-end Workflow', function () {
316
316
expect ( existsSync ( tmpFileLocation ) ) . to . be . equal ( true ) ;
317
317
} ) ;
318
318
319
- it . skip ( 'Installs sass support successfully' , function ( ) {
319
+ // Mobile mode doesn't have styles
320
+ it_not_mobile ( 'Supports scss in styleUrls' , function ( ) {
320
321
this . timeout ( 420000 ) ;
321
322
322
- sh . exec ( 'npm install node-sass' , { silent : true } ) ;
323
- return ng ( [ 'generate' , 'component' , 'test-component' ] )
324
- . then ( ( ) => {
325
- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
326
- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
327
- let scssFile = path . join ( componentPath , 'test-component.component.scss' ) ;
328
- let scssPartialFile = path . join ( componentPath , '_test-component.component.partial.scss' ) ;
329
-
330
- let scssPartialExample = '.partial {\n @extend .outer;\n }' ;
331
- fs . writeFileSync ( scssPartialFile , scssPartialExample , 'utf8' ) ;
332
- expect ( existsSync ( scssPartialFile ) ) . to . be . equal ( true ) ;
333
-
334
- expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
335
- sh . mv ( cssFile , scssFile ) ;
336
- expect ( existsSync ( scssFile ) ) . to . be . equal ( true ) ;
337
- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
338
- let scssExample = '@import "test-component.component.partial";\n\n.outer {\n .inner { background: #fff; }\n }' ;
339
- fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
340
-
341
- sh . exec ( `${ ngBin } build` ) ;
342
- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
343
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
344
- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
345
- expect ( contents ) . to . include ( '.outer .inner' ) ;
346
- expect ( contents ) . to . include ( '.partial .inner' ) ;
347
-
348
- sh . rm ( '-f' , destCss ) ;
349
- process . chdir ( 'src' ) ;
350
- sh . exec ( `${ ngBin } build` ) ;
351
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
352
- contents = fs . readFileSync ( destCss , 'utf8' ) ;
353
- expect ( contents ) . to . include ( '.outer .inner' ) ;
354
- expect ( contents ) . to . include ( '.partial .inner' ) ;
355
-
356
- process . chdir ( '..' ) ;
357
- sh . exec ( 'npm uninstall node-sass' , { silent : true } ) ;
358
- } ) ;
323
+ let cssFilename = 'app.component.css' ;
324
+ let scssFilename = 'app.component.scss' ;
325
+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
326
+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
327
+ let cssFile = path . join ( componentPath , cssFilename ) ;
328
+ let scssFile = path . join ( componentPath , scssFilename ) ;
329
+ let scssExample = '@import "app.component.partial";\n\n.outer {\n .inner { background: #fff; }\n }' ;
330
+ let scssPartialFile = path . join ( componentPath , '_app.component.partial.scss' ) ;
331
+ let scssPartialExample = '.partial {\n @extend .outer;\n }' ;
332
+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
333
+
334
+ sh . mv ( cssFile , scssFile ) ;
335
+ fs . writeFileSync ( scssFile , scssExample , 'utf8' ) ;
336
+ fs . writeFileSync ( scssPartialFile , scssPartialExample , 'utf8' ) ;
337
+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , scssFilename ) , 'utf8' ) ;
338
+
339
+ sh . exec ( `${ ngBin } build` ) ;
340
+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
341
+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
342
+ expect ( contents ) . to . include ( '.outer .inner' ) ;
343
+ expect ( contents ) . to . include ( '.partial .inner' ) ;
344
+
345
+ sh . mv ( scssFile , cssFile ) ;
346
+ fs . writeFileSync ( cssFile , '' , 'utf8' ) ;
347
+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
348
+ sh . rm ( '-f' , scssPartialFile ) ;
359
349
} ) ;
360
350
361
- it . skip ( 'Installs less support successfully' , function ( ) {
351
+ // Mobile mode doesn't have styles
352
+ it_not_mobile ( 'Supports less in styleUrls' , function ( ) {
362
353
this . timeout ( 420000 ) ;
363
354
364
- sh . exec ( 'npm install less' , { silent : true } ) ;
365
- return ng ( [ 'generate' , 'component' , 'test-component' ] )
366
- . then ( ( ) => {
367
- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
368
- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
369
- let lessFile = path . join ( componentPath , 'test-component.component.less' ) ;
370
-
371
- expect ( existsSync ( componentPath ) ) . to . be . equal ( true ) ;
372
- sh . mv ( cssFile , lessFile ) ;
373
- expect ( existsSync ( lessFile ) ) . to . be . equal ( true ) ;
374
- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
375
- let lessExample = '.outer {\n .inner { background: #fff; }\n }' ;
376
- fs . writeFileSync ( lessFile , lessExample , 'utf8' ) ;
377
-
378
- sh . exec ( `${ ngBin } build` ) ;
379
- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
380
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
381
- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
382
- expect ( contents ) . to . include ( '.outer .inner' ) ;
383
-
384
- sh . rm ( '-f' , destCss ) ;
385
- process . chdir ( 'src' ) ;
386
- sh . exec ( `${ ngBin } build` ) ;
387
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
388
- contents = fs . readFileSync ( destCss , 'utf8' ) ;
389
- expect ( contents ) . to . include ( '.outer .inner' ) ;
390
-
391
- process . chdir ( '..' ) ;
392
- sh . exec ( 'npm uninstall less' , { silent : true } ) ;
393
- } ) ;
355
+ let cssFilename = 'app.component.css' ;
356
+ let lessFilename = 'app.component.less' ;
357
+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
358
+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
359
+ let cssFile = path . join ( componentPath , cssFilename ) ;
360
+ let lessFile = path . join ( componentPath , lessFilename ) ;
361
+ let lessExample = '.outer {\n .inner { background: #fff; }\n }' ;
362
+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
363
+
364
+ sh . mv ( cssFile , lessFile ) ;
365
+ fs . writeFileSync ( lessFile , lessExample , 'utf8' ) ;
366
+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , lessFilename ) , 'utf8' ) ;
367
+
368
+ sh . exec ( `${ ngBin } build` ) ;
369
+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
370
+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
371
+ expect ( contents ) . to . include ( '.outer .inner' ) ;
372
+
373
+ fs . writeFileSync ( lessFile , '' , 'utf8' ) ;
374
+ sh . mv ( lessFile , cssFile ) ;
375
+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
394
376
} ) ;
395
377
396
- it . skip ( 'Installs stylus support successfully' , function ( ) {
378
+ // Mobile mode doesn't have styles
379
+ it_not_mobile ( 'Supports stylus in styleUrls' , function ( ) {
397
380
this . timeout ( 420000 ) ;
398
381
399
- sh . exec ( 'npm install stylus' , { silent : true } ) ;
400
- return ng ( [ 'generate' , 'component' , 'test-component' ] )
401
- . then ( ( ) => {
402
- let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' , 'test-component' ) ;
403
- let cssFile = path . join ( componentPath , 'test-component.component.css' ) ;
404
- let stylusFile = path . join ( componentPath , 'test-component.component.styl' ) ;
405
-
406
- sh . mv ( cssFile , stylusFile ) ;
407
- expect ( existsSync ( stylusFile ) ) . to . be . equal ( true ) ;
408
- expect ( existsSync ( cssFile ) ) . to . be . equal ( false ) ;
409
- let stylusExample = '.outer {\n .inner { background: #fff; }\n }' ;
410
- fs . writeFileSync ( stylusFile , stylusExample , 'utf8' ) ;
411
-
412
- sh . exec ( `${ ngBin } build` ) ;
413
- let destCss = path . join ( process . cwd ( ) , 'dist' , 'app' , 'test-component' , 'test-component.component.css' ) ;
414
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
415
- let contents = fs . readFileSync ( destCss , 'utf8' ) ;
416
- expect ( contents ) . to . include ( '.outer .inner' ) ;
417
-
418
- sh . rm ( '-f' , destCss ) ;
419
- process . chdir ( 'src' ) ;
420
- sh . exec ( `${ ngBin } build` ) ;
421
- expect ( existsSync ( destCss ) ) . to . be . equal ( true ) ;
422
- contents = fs . readFileSync ( destCss , 'utf8' ) ;
423
- expect ( contents ) . to . include ( '.outer .inner' ) ;
424
-
425
- process . chdir ( '..' ) ;
426
- sh . exec ( 'npm uninstall stylus' , { silent : true } ) ;
427
- } ) ;
382
+ let cssFilename = 'app.component.css' ;
383
+ let stylusFilename = 'app.component.scss' ;
384
+ let componentPath = path . join ( process . cwd ( ) , 'src' , 'app' ) ;
385
+ let componentFile = path . join ( componentPath , 'app.component.ts' ) ;
386
+ let cssFile = path . join ( componentPath , cssFilename ) ;
387
+ let stylusFile = path . join ( componentPath , stylusFilename ) ;
388
+ let stylusExample = '.outer {\n .inner { background: #fff; }\n }' ;
389
+ let componentContents = fs . readFileSync ( componentFile , 'utf8' ) ;
390
+
391
+ sh . mv ( cssFile , stylusFile ) ;
392
+ fs . writeFileSync ( stylusFile , stylusExample , 'utf8' ) ;
393
+ fs . writeFileSync ( componentFile , componentContents . replace ( new RegExp ( cssFilename , 'g' ) , stylusFilename ) , 'utf8' ) ;
394
+
395
+ sh . exec ( `${ ngBin } build` ) ;
396
+ let destCssBundle = path . join ( process . cwd ( ) , 'dist' , 'main.bundle.js' ) ;
397
+ let contents = fs . readFileSync ( destCssBundle , 'utf8' ) ;
398
+ expect ( contents ) . to . include ( '.outer .inner' ) ;
399
+
400
+ fs . writeFileSync ( stylusFile , '' , 'utf8' ) ;
401
+ sh . mv ( stylusFile , cssFile ) ;
402
+ fs . writeFileSync ( componentFile , componentContents , 'utf8' ) ;
428
403
} ) ;
429
404
430
- // This test causes complications with path resolution in TS broccoli plugin,
431
- // and isn't mobile specific
432
- it_not_mobile ( 'Turn on `noImplicitAny` in tsconfig.json and rebuild' , function ( ) {
405
+ it ( 'Turn on `noImplicitAny` in tsconfig.json and rebuild' , function ( ) {
433
406
this . timeout ( 420000 ) ;
434
407
435
408
const configFilePath = path . join ( process . cwd ( ) , 'src' , 'tsconfig.json' ) ;
0 commit comments