File tree Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Expand file tree Collapse file tree 4 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ describe('OverlayContainer', () => {
37
37
overlayRef . attach ( fixture . componentInstance . templatePortal ) ;
38
38
fixture . detectChanges ( ) ;
39
39
40
- expect ( document . querySelectorAll ( '.cdk-overlay-container' ) )
40
+ expect ( document . querySelector ( '.cdk-overlay-container' ) )
41
41
. not . toBeNull ( 'Expected the overlay container to be in the DOM after opening an overlay' ) ;
42
42
43
43
// Manually call `ngOnDestroy` because there is no way to force Angular to destroy an
Original file line number Diff line number Diff line change @@ -89,11 +89,12 @@ describe('MatAutocomplete', () => {
89
89
return TestBed . createComponent ( component ) ;
90
90
}
91
91
92
- afterEach ( ( ) => {
93
- if ( overlayContainer ) {
94
- overlayContainer . ngOnDestroy ( ) ;
95
- }
96
- } ) ;
92
+ afterEach ( inject ( [ OverlayContainer ] , ( currentOverlayContainer : OverlayContainer ) => {
93
+ // Since we're resetting the testing module in some of the tests,
94
+ // we can potentially have multiple overlay containers.
95
+ currentOverlayContainer . ngOnDestroy ( ) ;
96
+ overlayContainer . ngOnDestroy ( ) ;
97
+ } ) ) ;
97
98
98
99
describe ( 'panel toggling' , ( ) => {
99
100
let fixture : ComponentFixture < SimpleAutocomplete > ;
@@ -598,6 +599,7 @@ describe('MatAutocomplete', () => {
598
599
} ) ;
599
600
600
601
it ( 'should disable the input when used with a value accessor and without `matInput`' , ( ) => {
602
+ overlayContainer . ngOnDestroy ( ) ;
601
603
fixture . destroy ( ) ;
602
604
TestBed . resetTestingModule ( ) ;
603
605
Original file line number Diff line number Diff line change @@ -72,9 +72,12 @@ describe('MatMenu', () => {
72
72
} ) ( ) ;
73
73
} ) ) ;
74
74
75
- afterEach ( ( ) => {
75
+ afterEach ( inject ( [ OverlayContainer ] , ( currentOverlayContainer : OverlayContainer ) => {
76
+ // Since we're resetting the testing module in some of the tests,
77
+ // we can potentially have multiple overlay containers.
78
+ currentOverlayContainer . ngOnDestroy ( ) ;
76
79
overlayContainer . ngOnDestroy ( ) ;
77
- } ) ;
80
+ } ) ) ;
78
81
79
82
it ( 'should open the menu as an idempotent operation' , ( ) => {
80
83
const fixture = TestBed . createComponent ( SimpleMenu ) ;
Original file line number Diff line number Diff line change @@ -69,9 +69,12 @@ describe('MatTooltip', () => {
69
69
} ) ( ) ;
70
70
} ) ) ;
71
71
72
- afterEach ( ( ) => {
72
+ afterEach ( inject ( [ OverlayContainer ] , ( currentOverlayContainer : OverlayContainer ) => {
73
+ // Since we're resetting the testing module in some of the tests,
74
+ // we can potentially have multiple overlay containers.
75
+ currentOverlayContainer . ngOnDestroy ( ) ;
73
76
overlayContainer . ngOnDestroy ( ) ;
74
- } ) ;
77
+ } ) ) ;
75
78
76
79
describe ( 'basic usage' , ( ) => {
77
80
let fixture : ComponentFixture < BasicTooltipDemo > ;
You can’t perform that action at this time.
0 commit comments