@@ -619,7 +619,7 @@ describe('Application Schematic', () => {
619619 const path = '/projects/foo/src/main.ts' ;
620620 const content = tree . readContent ( path ) ;
621621 expect ( content ) . toContain ( 'defaultEncapsulation: ViewEncapsulation.ShadowDom' ) ;
622- expect ( content ) . toContain ( `import { ViewEncapsulation } from '@angular/core'` ) ;
622+ expect ( content ) . toContain ( `const { ViewEncapsulation } = await import( '@angular/core'); ` ) ;
623623 } ) ;
624624
625625 it ( 'should handle the routing flag' , async ( ) => {
@@ -698,5 +698,48 @@ describe('Application Schematic', () => {
698698 } ) ,
699699 ) ;
700700 } ) ;
701+
702+ it ( 'should add provideExperimentalZonelessChangeDetection() when experimentalZoneless is true' , async ( ) => {
703+ const tree = await schematicRunner . runSchematic (
704+ 'application' ,
705+ {
706+ ...defaultOptions ,
707+ experimentalZoneless : true ,
708+ } ,
709+ workspaceTree ,
710+ ) ;
711+ const path = '/projects/foo/src/app/app.config.ts' ;
712+ console . log ( 'tree => ' , tree ) ;
713+ const fileContent = tree . readContent ( path ) ;
714+ expect ( fileContent ) . toContain ( 'provideExperimentalZonelessChangeDetection()' ) ;
715+ } ) ;
716+
717+ it ( 'should not add provideExperimentalZonelessChangeDetection() when experimentalZoneless is false' , async ( ) => {
718+ const tree = await schematicRunner . runSchematic (
719+ 'application' ,
720+ {
721+ ...defaultOptions ,
722+ experimentalZoneless : false ,
723+ } ,
724+ workspaceTree ,
725+ ) ;
726+ const path = '/projects/foo/src/app/app.config.ts' ;
727+ const fileContent = tree . readContent ( path ) ;
728+ expect ( fileContent ) . not . toContain ( 'provideExperimentalZonelessChangeDetection()' ) ;
729+ } ) ;
730+
731+ it ( 'should not add provideZoneChangeDetection when experimentalZoneless is true' , async ( ) => {
732+ const tree = await schematicRunner . runSchematic (
733+ 'application' ,
734+ {
735+ ...defaultOptions ,
736+ experimentalZoneless : true ,
737+ } ,
738+ workspaceTree ,
739+ ) ;
740+ const path = '/projects/foo/src/app/app.config.ts' ;
741+ const fileContent = tree . readContent ( path ) ;
742+ expect ( fileContent ) . not . toContain ( 'provideZoneChangeDetection' ) ;
743+ } ) ;
701744 } ) ;
702745} ) ;
0 commit comments