@@ -40,13 +40,7 @@ import {
4040 ViewChildren ,
4141 ViewContainerRef ,
4242} from '../../src/core' ;
43- import {
44- ComponentFixture ,
45- ComponentFixtureAutoDetect ,
46- fakeAsync ,
47- TestBed ,
48- tick ,
49- } from '../../testing' ;
43+ import { ComponentFixture , ComponentFixtureAutoDetect , TestBed } from '../../testing' ;
5044
5145describe ( 'change detection' , ( ) => {
5246 beforeEach ( ( ) => {
@@ -121,7 +115,6 @@ describe('change detection', () => {
121115 @Component ( {
122116 selector : 'onpush' ,
123117 template : '' ,
124- changeDetection : ChangeDetectionStrategy . OnPush ,
125118 } )
126119 class OnPushComponent {
127120 checks = 0 ;
@@ -220,7 +213,6 @@ describe('change detection', () => {
220213
221214 @Component ( {
222215 template : `<ng-template #vm="vm" viewManipulation></ng-template>` ,
223- changeDetection : ChangeDetectionStrategy . OnPush ,
224216 imports : [ ViewManipulation ] ,
225217 } )
226218 class App { }
@@ -230,7 +222,6 @@ describe('change detection', () => {
230222 <button (click)="noop()">Trigger change detection</button>
231223 <div>{{ increment() }}</div>
232224 ` ,
233- changeDetection : ChangeDetectionStrategy . OnPush ,
234225 } )
235226 class DynamicComp {
236227 increment ( ) {
@@ -272,7 +263,6 @@ describe('change detection', () => {
272263 selector : 'child' ,
273264 template : '<ng-container *viewManipulation>{{data()}}</ng-container>' ,
274265 imports : [ ViewManipulation ] ,
275- changeDetection : ChangeDetectionStrategy . OnPush ,
276266 } )
277267 class ChildComponent {
278268 data = data ;
@@ -312,7 +302,6 @@ describe('change detection', () => {
312302 @Component ( {
313303 selector : `test-cmpt` ,
314304 template : `{{ counter }}|<ng-template #vc></ng-template>` ,
315- changeDetection : ChangeDetectionStrategy . OnPush ,
316305 } )
317306 class TestCmpt {
318307 counter = 0 ;
@@ -326,7 +315,6 @@ describe('change detection', () => {
326315 @Component ( {
327316 selector : 'dynamic-cmpt' ,
328317 template : `dynamic|{{ binding }}` ,
329- changeDetection : ChangeDetectionStrategy . OnPush ,
330318 } )
331319 class DynamicCmpt {
332320 @Input ( ) binding = 'binding' ;
@@ -429,7 +417,6 @@ describe('change detection', () => {
429417 describe ( 'OnPush' , ( ) => {
430418 @Component ( {
431419 selector : 'my-comp' ,
432- changeDetection : ChangeDetectionStrategy . OnPush ,
433420 template : `{{ doCheckCount }} - {{ name }} <button (click)="onClick()"></button>` ,
434421 standalone : false ,
435422 } )
@@ -570,7 +557,6 @@ describe('change detection', () => {
570557 @Component ( {
571558 selector : 'button-parent' ,
572559 template : '{{ doCheckCount }} - <my-comp></my-comp>' ,
573- changeDetection : ChangeDetectionStrategy . OnPush ,
574560 standalone : false ,
575561 } )
576562 class ButtonParent implements DoCheck {
@@ -624,7 +610,7 @@ describe('change detection', () => {
624610 expect ( fixture . nativeElement . textContent . trim ( ) ) . toEqual ( '3 - 2 - Nancy' ) ;
625611 } ) ;
626612
627- it ( 'should check parent OnPush components when child directive on a template emits event' , fakeAsync ( ( ) => {
613+ it ( 'should check parent OnPush components when child directive on a template emits event' , async ( ) => {
628614 @Directive ( {
629615 selector : '[emitter]' ,
630616 standalone : false ,
@@ -642,7 +628,6 @@ describe('change detection', () => {
642628 @Component ( {
643629 selector : 'my-app' ,
644630 template : '{{message}} <ng-template emitter (event)="message = $event"></ng-template>' ,
645- changeDetection : ChangeDetectionStrategy . OnPush ,
646631 standalone : false ,
647632 } )
648633 class MyApp {
@@ -655,18 +640,17 @@ describe('change detection', () => {
655640 fixture . detectChanges ( ) ;
656641
657642 expect ( fixture . nativeElement . textContent . trim ( ) ) . toEqual ( 'initial message' ) ;
658- tick ( ) ;
643+ await fixture . whenStable ( ) ;
659644 fixture . detectChanges ( ) ;
660645 expect ( fixture . nativeElement . textContent . trim ( ) ) . toEqual ( 'new message' ) ;
661- } ) ) ;
646+ } ) ;
662647 } ) ;
663648
664649 describe ( 'ChangeDetectorRef' , ( ) => {
665650 describe ( 'detectChanges()' , ( ) => {
666651 @Component ( {
667652 selector : 'my-comp' ,
668653 template : '{{ name }}' ,
669- changeDetection : ChangeDetectionStrategy . OnPush ,
670654 standalone : false ,
671655 } )
672656 class MyComp implements DoCheck {
@@ -1193,7 +1177,6 @@ describe('change detection', () => {
11931177 @Component ( {
11941178 selector : 'on-push-comp' ,
11951179 template : '{{ value }}' ,
1196- changeDetection : ChangeDetectionStrategy . OnPush ,
11971180 standalone : false ,
11981181 } )
11991182 class OnPushComp {
@@ -1238,7 +1221,6 @@ describe('change detection', () => {
12381221 @Component ( {
12391222 selector : 'on-push-comp' ,
12401223 template : '{{ value }}' ,
1241- changeDetection : ChangeDetectionStrategy . OnPush ,
12421224 standalone : false ,
12431225 } )
12441226 class OnPushComp implements DoCheck {
@@ -1255,7 +1237,6 @@ describe('change detection', () => {
12551237
12561238 @Component ( {
12571239 template : '{{ value }} - <on-push-comp></on-push-comp>' ,
1258- changeDetection : ChangeDetectionStrategy . OnPush ,
12591240 standalone : false ,
12601241 } )
12611242 class OnPushParent {
@@ -1317,7 +1298,6 @@ describe('change detection', () => {
13171298 it ( 'should ensure OnPush components in embedded views are checked' , ( ) => {
13181299 @Component ( {
13191300 template : '{{ value }} - <on-push-comp *ngIf="showing"></on-push-comp>' ,
1320- changeDetection : ChangeDetectionStrategy . OnPush ,
13211301 standalone : false ,
13221302 } )
13231303 class EmbeddedViewParent {
@@ -1358,7 +1338,6 @@ describe('change detection', () => {
13581338 it ( 'async pipe should trigger CD for embedded views where the declaration and insertion views are different' , ( ) => {
13591339 @Component ( {
13601340 selector : 'insertion' ,
1361- changeDetection : ChangeDetectionStrategy . OnPush ,
13621341 template : ` <ng-container [ngTemplateOutlet]="template"> </ng-container> ` ,
13631342 standalone : false ,
13641343 } )
@@ -1369,7 +1348,6 @@ describe('change detection', () => {
13691348 // This component uses async pipe (which calls markForCheck) in a view that has different
13701349 // insertion and declaration views.
13711350 @Component ( {
1372- changeDetection : ChangeDetectionStrategy . OnPush ,
13731351 template : `
13741352 <insertion [template]="ref"></insertion>
13751353 <ng-template #ref>
@@ -1537,7 +1515,6 @@ describe('change detection', () => {
15371515 } ) ;
15381516
15391517 @Component ( {
1540- changeDetection : ChangeDetectionStrategy . OnPush ,
15411518 template : '{{state}}{{resolveReadPromise()}}' ,
15421519 } )
15431520 class MyApp {
@@ -1617,7 +1594,6 @@ describe('change detection', () => {
16171594
16181595 @Component ( {
16191596 template : '{{state}}' ,
1620- changeDetection : ChangeDetectionStrategy . OnPush ,
16211597 } )
16221598 class NotUnidirectionalDataFlow {
16231599 state = 1 ;
@@ -1653,7 +1629,6 @@ describe('change detection', () => {
16531629 it ( `should be able to mark component as dirty from within ${ hookName } ` , ( ) => {
16541630 @Component ( {
16551631 selector : 'on-push-comp' ,
1656- changeDetection : ChangeDetectionStrategy . OnPush ,
16571632 template : `<p>{{ text }}</p>` ,
16581633 standalone : false ,
16591634 } )
@@ -1705,7 +1680,6 @@ describe('change detection', () => {
17051680 it ( `should not be able to mark component as dirty from within ${ hookName } ` , ( ) => {
17061681 @Component ( {
17071682 selector : 'on-push-comp' ,
1708- changeDetection : ChangeDetectionStrategy . OnPush ,
17091683 template : `<p>{{ text }}</p>` ,
17101684 standalone : false ,
17111685 } )
0 commit comments