11import { DataSource } from '@angular/cdk/collections' ;
2- import { LEFT_ARROW , UP_ARROW , RIGHT_ARROW , DOWN_ARROW , TAB } from '@angular/cdk/keycodes' ;
3- import { MatTableModule } from '@angular/material/table' ;
4- import { dispatchKeyboardEvent } from '../../cdk/testing/private' ;
2+ import { DOWN_ARROW , LEFT_ARROW , RIGHT_ARROW , TAB , UP_ARROW } from '@angular/cdk/keycodes' ;
53import { CommonModule } from '@angular/common' ;
6- import {
7- Component ,
8- Directive ,
9- ElementRef ,
10- ViewChild ,
11- provideZoneChangeDetection ,
12- } from '@angular/core' ;
13- import { ComponentFixture , fakeAsync , flush , TestBed , tick } from '@angular/core/testing' ;
4+ import { Component , Directive , ElementRef , ViewChild } from '@angular/core' ;
5+ import { ComponentFixture , TestBed , fakeAsync , flush , tick } from '@angular/core/testing' ;
146import { FormsModule , NgForm } from '@angular/forms' ;
7+ import { MatTableModule } from '@angular/material/table' ;
158import { BehaviorSubject } from 'rxjs' ;
9+ import { dispatchKeyboardEvent } from '../../cdk/testing/private' ;
1610
1711import {
1812 CdkPopoverEditColspan ,
19- HoverContentState ,
2013 FormValueContainer ,
14+ HoverContentState ,
2115 PopoverEditClickOutBehavior ,
2216} from '@angular/cdk-experimental/popover-edit' ;
2317import { MatPopoverEditModule } from './index' ;
@@ -297,12 +291,6 @@ const testCases = [
297291] as const ;
298292
299293describe ( 'Material Popover Edit' , ( ) => {
300- beforeEach ( ( ) => {
301- TestBed . configureTestingModule ( {
302- providers : [ provideZoneChangeDetection ( ) ] ,
303- } ) ;
304- } ) ;
305-
306294 for ( const [ componentClass , label ] of testCases ) {
307295 describe ( label , ( ) => {
308296 let component : BaseTestComponent ;
@@ -317,6 +305,7 @@ describe('Material Popover Edit', () => {
317305 component = fixture . componentInstance ;
318306 fixture . detectChanges ( ) ;
319307 tick ( 10 ) ;
308+ fixture . detectChanges ( ) ;
320309 } ) ) ;
321310
322311 describe ( 'row hover content' , ( ) => {
@@ -432,6 +421,7 @@ describe('Material Popover Edit', () => {
432421
433422 it ( 'does not trigger edit when disabled' , fakeAsync ( ( ) => {
434423 component . nameEditDisabled = true ;
424+ fixture . changeDetectorRef . markForCheck ( ) ;
435425 fixture . detectChanges ( ) ;
436426
437427 // Uses Enter to open the lens.
@@ -452,6 +442,7 @@ describe('Material Popover Edit', () => {
452442
453443 it ( 'unsets tabindex to 0 on disabled cells' , ( ) => {
454444 component . nameEditDisabled = true ;
445+ fixture . changeDetectorRef . markForCheck ( ) ;
455446 fixture . detectChanges ( ) ;
456447
457448 expect ( component . getEditCell ( ) . hasAttribute ( 'tabindex' ) ) . toBe ( false ) ;
@@ -594,6 +585,7 @@ matPopoverEditTabOut`, fakeAsync(() => {
594585
595586 it ( 'positions the lens at the top left corner and spans the full width of the cell' , fakeAsync ( ( ) => {
596587 component . openLens ( ) ;
588+ fixture . detectChanges ( ) ;
597589
598590 const paneRect = component . getEditPane ( ) ! . getBoundingClientRect ( ) ;
599591 const cellRect = component . getEditCell ( ) . getBoundingClientRect ( ) ;
@@ -610,16 +602,19 @@ matPopoverEditTabOut`, fakeAsync(() => {
610602 ) ;
611603
612604 component . colspan = { before : 1 } ;
605+ fixture . changeDetectorRef . markForCheck ( ) ;
613606 fixture . detectChanges ( ) ;
614607
615608 component . openLens ( ) ;
609+ fixture . detectChanges ( ) ;
616610
617611 let paneRect = component . getEditPane ( ) ! . getBoundingClientRect ( ) ;
618612 expectPixelsToEqual ( paneRect . top , cellRects [ 0 ] . top ) ;
619613 expectPixelsToEqual ( paneRect . left , cellRects [ 0 ] . left ) ;
620614 expectPixelsToEqual ( paneRect . right , cellRects [ 1 ] . right ) ;
621615
622616 component . colspan = { after : 1 } ;
617+ fixture . changeDetectorRef . markForCheck ( ) ;
623618 fixture . detectChanges ( ) ;
624619
625620 paneRect = component . getEditPane ( ) ! . getBoundingClientRect ( ) ;
@@ -630,6 +625,7 @@ matPopoverEditTabOut`, fakeAsync(() => {
630625 // expectPixelsToEqual(paneRect.right, cellRects[2].right);
631626
632627 component . colspan = { before : 1 , after : 1 } ;
628+ fixture . changeDetectorRef . markForCheck ( ) ;
633629 fixture . detectChanges ( ) ;
634630
635631 paneRect = component . getEditPane ( ) ! . getBoundingClientRect ( ) ;
@@ -706,13 +702,15 @@ matPopoverEditTabOut`, fakeAsync(() => {
706702 expect ( component . lensIsOpen ( ) ) . toBe ( false ) ;
707703
708704 component . openLens ( ) ;
705+ fixture . detectChanges ( ) ;
709706
710707 expect ( component . getInput ( ) ! . value ) . toBe ( 'Hydragon' ) ;
711708 clearLeftoverTimers ( ) ;
712709 } ) ) ;
713710
714711 it ( 'resets the lens to original value' , fakeAsync ( ( ) => {
715712 component . openLens ( ) ;
713+ fixture . detectChanges ( ) ;
716714
717715 component . getInput ( ) ! . value = 'Hydragon' ;
718716 component . getInput ( ) ! . dispatchEvent ( new Event ( 'input' ) ) ;
@@ -733,6 +731,7 @@ matPopoverEditTabOut`, fakeAsync(() => {
733731 fixture . detectChanges ( ) ;
734732
735733 component . openLens ( ) ;
734+ fixture . detectChanges ( ) ;
736735
737736 component . getInput ( ) ! . value = 'Hydragon X' ;
738737 component . getInput ( ) ! . dispatchEvent ( new Event ( 'input' ) ) ;
0 commit comments