@@ -668,6 +668,75 @@ describe('ng-add schematic', () => {
668
668
. toContain ( 'BrowserAnimationsModule' ) ;
669
669
} ) ;
670
670
} ) ;
671
+
672
+ describe ( 'using browser-esbuild builder' , ( ) => {
673
+ beforeEach ( ( ) => {
674
+ const config = {
675
+ version : 1 ,
676
+ projects : {
677
+ material : {
678
+ projectType : 'application' ,
679
+ root : 'projects/material' ,
680
+ sourceRoot : 'projects/material/src' ,
681
+ prefix : 'app' ,
682
+ architect : {
683
+ build : {
684
+ builder : '@angular-devkit/build-angular:browser-esbuild' ,
685
+ options : {
686
+ outputPath : 'dist/material' ,
687
+ index : 'projects/material/src/index.html' ,
688
+ main : 'projects/material/src/main.ts' ,
689
+ styles : [ 'projects/material/src/styles.css' ] ,
690
+ } ,
691
+ } ,
692
+ test : {
693
+ builder : '@angular-devkit/build-angular:karma' ,
694
+ options : {
695
+ outputPath : 'dist/material' ,
696
+ index : 'projects/material/src/index.html' ,
697
+ browser : 'projects/material/src/main.ts' ,
698
+ styles : [ 'projects/material/src/styles.css' ] ,
699
+ } ,
700
+ } ,
701
+ } ,
702
+ } ,
703
+ } ,
704
+ } ;
705
+
706
+ appTree . overwrite ( '/angular.json' , JSON . stringify ( config , null , 2 ) ) ;
707
+ } ) ;
708
+
709
+ it ( 'should add a theme' , async ( ) => {
710
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
711
+ const workspace = await getWorkspace ( tree ) ;
712
+ const project = getProjectFromWorkspace ( workspace , baseOptions . project ) ;
713
+
714
+ expectProjectStyleFile ( project , '@angular/material/prebuilt-themes/indigo-pink.css' ) ;
715
+ } ) ;
716
+
717
+ it ( 'should add material app styles' , async ( ) => {
718
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
719
+ const workspace = await getWorkspace ( tree ) ;
720
+ const project = getProjectFromWorkspace ( workspace , baseOptions . project ) ;
721
+
722
+ const defaultStylesPath = getProjectStyleFile ( project ) ! ;
723
+ const htmlContent = tree . read ( defaultStylesPath ) ! . toString ( ) ;
724
+
725
+ expect ( htmlContent ) . toContain ( 'html, body { height: 100%; }' ) ;
726
+ expect ( htmlContent ) . toContain (
727
+ 'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
728
+ ) ;
729
+ } ) ;
730
+
731
+ it ( 'should add the BrowserAnimationsModule to the project module' , async ( ) => {
732
+ const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
733
+ const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
734
+
735
+ expect ( fileContent )
736
+ . withContext ( 'Expected the project app module to import the "BrowserAnimationsModule".' )
737
+ . toContain ( 'BrowserAnimationsModule' ) ;
738
+ } ) ;
739
+ } ) ;
671
740
} ) ;
672
741
673
742
describe ( 'ng-add schematic - library project' , ( ) => {
0 commit comments