File tree 2 files changed +24
-5
lines changed
packages/schematics/angular/application
2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import { AppModule } from './app/app.module';
5
5
6
- <% if(!!viewEncapsulation) { %>
7
6
platformBrowserDynamic().bootstrapModule(AppModule, {
8
- defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %>
7
+ ngZoneEventCoalescing: true<% if(!!viewEncapsulation) { %>,
8
+ defaultEncapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } %>
9
9
})
10
- .catch(err => console.error(err));<% } else { %>
11
- platformBrowserDynamic().bootstrapModule(AppModule)
12
10
.catch(err => console.error(err));
13
- <% } %>
Original file line number Diff line number Diff line change @@ -540,6 +540,14 @@ describe('Application Schematic', () => {
540
540
expect ( moduleFiles . length ) . toEqual ( 0 ) ;
541
541
} ) ;
542
542
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
+
543
551
it ( 'should create a standalone component' , async ( ) => {
544
552
const options = { ...defaultOptions , standalone : true } ;
545
553
@@ -575,6 +583,20 @@ describe('Application Schematic', () => {
575
583
} ) ;
576
584
577
585
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
+
578
600
it ( `should set 'defaultEncapsulation' in main.ts when 'ViewEncapsulation' is provided` , async ( ) => {
579
601
const tree = await schematicRunner . runSchematic (
580
602
'application' ,
You can’t perform that action at this time.
0 commit comments