File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
packages/schematics/angular/application Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change 33
44import { AppModule } from './app/app.module';
55
6- <% if(!!viewEncapsulation) { %>
76platformBrowserDynamic().bootstrapModule(AppModule, {
8- defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %>
7+ ngZoneEventCoalescing: true<% if(!!viewEncapsulation) { %>,
8+ defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %>
99})
10- .catch(err => console.error(err));<% } else { %>
11- platformBrowserDynamic().bootstrapModule(AppModule)
1210 .catch(err => console.error(err));
13- <% } %>
Original file line number Diff line number Diff line change @@ -540,6 +540,14 @@ describe('Application Schematic', () => {
540540 expect ( moduleFiles . length ) . toEqual ( 0 ) ;
541541 } ) ;
542542
543+ it ( 'should enable zone event coalescing by default' , async ( ) => {
544+ const options = { ...defaultOptions , standalone : true } ;
545+
546+ const tree = await schematicRunner . runSchematic ( 'application' , options , workspaceTree ) ;
547+ const appConfig = tree . readContent ( '/projects/foo/src/app/app.config.ts' ) ;
548+ expect ( appConfig ) . toContain ( 'provideZoneChangeDetection({eventCoalescing: true})' ) ;
549+ } ) ;
550+
543551 it ( 'should create a standalone component' , async ( ) => {
544552 const options = { ...defaultOptions , standalone : true } ;
545553
@@ -575,6 +583,20 @@ describe('Application Schematic', () => {
575583 } ) ;
576584
577585 describe ( 'standalone=false' , ( ) => {
586+ it ( 'should add the ngZoneEventCoalescing option by default' , async ( ) => {
587+ const tree = await schematicRunner . runSchematic (
588+ 'application' ,
589+ {
590+ ...defaultOptions ,
591+ standalone : false ,
592+ } ,
593+ workspaceTree ,
594+ ) ;
595+
596+ const content = tree . readContent ( '/projects/foo/src/main.ts' ) ;
597+ expect ( content ) . toContain ( 'ngZoneEventCoalescing: true' ) ;
598+ } ) ;
599+
578600 it ( `should set 'defaultEncapsulation' in main.ts when 'ViewEncapsulation' is provided` , async ( ) => {
579601 const tree = await schematicRunner . runSchematic (
580602 'application' ,
You can’t perform that action at this time.
0 commit comments