@@ -599,6 +599,75 @@ describe('ng-add schematic', () => {
599
599
expect ( buffer . toString ( ) ) . toContain ( '<body class="one two">' ) ;
600
600
} ) ;
601
601
} ) ;
602
+
603
+ describe ( 'using browser builder' , ( ) => {
604
+ beforeEach ( ( ) => {
605
+ const config = {
606
+ version : 1 ,
607
+ projects : {
608
+ material : {
609
+ projectType : 'application' ,
610
+ root : 'projects/material' ,
611
+ sourceRoot : 'projects/material/src' ,
612
+ prefix : 'app' ,
613
+ architect : {
614
+ build : {
615
+ builder : '@angular-devkit/build-angular:browser' ,
616
+ options : {
617
+ outputPath : 'dist/material' ,
618
+ index : 'projects/material/src/index.html' ,
619
+ main : 'projects/material/src/main.ts' ,
620
+ styles : [ 'projects/material/src/styles.css' ] ,
621
+ } ,
622
+ } ,
623
+ test : {
624
+ builder : '@angular-devkit/build-angular:karma' ,
625
+ options : {
626
+ outputPath : 'dist/material' ,
627
+ index : 'projects/material/src/index.html' ,
628
+ browser : 'projects/material/src/main.ts' ,
629
+ styles : [ 'projects/material/src/styles.css' ] ,
630
+ } ,
631
+ } ,
632
+ } ,
633
+ } ,
634
+ } ,
635
+ } ;
636
+
637
+ appTree . overwrite ( '/angular.json' , JSON . stringify ( config , null , 2 ) ) ;
638
+ } ) ;
639
+
640
+ it ( 'should add a theme' , async ( ) => {
641
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
642
+ const workspace = await getWorkspace ( tree ) ;
643
+ const project = getProjectFromWorkspace ( workspace , baseOptions . project ) ;
644
+
645
+ expectProjectStyleFile ( project , '@angular/material/prebuilt-themes/indigo-pink.css' ) ;
646
+ } ) ;
647
+
648
+ it ( 'should add material app styles' , async ( ) => {
649
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
650
+ const workspace = await getWorkspace ( tree ) ;
651
+ const project = getProjectFromWorkspace ( workspace , baseOptions . project ) ;
652
+
653
+ const defaultStylesPath = getProjectStyleFile ( project ) ! ;
654
+ const htmlContent = tree . read ( defaultStylesPath ) ! . toString ( ) ;
655
+
656
+ expect ( htmlContent ) . toContain ( 'html, body { height: 100%; }' ) ;
657
+ expect ( htmlContent ) . toContain (
658
+ 'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
659
+ ) ;
660
+ } ) ;
661
+
662
+ it ( 'should add the BrowserAnimationsModule to the project module' , async ( ) => {
663
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
664
+ const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
665
+
666
+ expect ( fileContent )
667
+ . withContext ( 'Expected the project app module to import the "BrowserAnimationsModule".' )
668
+ . toContain ( 'BrowserAnimationsModule' ) ;
669
+ } ) ;
670
+ } ) ;
602
671
} ) ;
603
672
604
673
describe ( 'ng-add schematic - library project' , ( ) => {
0 commit comments