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', () => {
3737 overlayRef . attach ( fixture . componentInstance . templatePortal ) ;
3838 fixture . detectChanges ( ) ;
3939
40- expect ( document . querySelectorAll ( '.cdk-overlay-container' ) )
40+ expect ( document . querySelector ( '.cdk-overlay-container' ) )
4141 . not . toBeNull ( 'Expected the overlay container to be in the DOM after opening an overlay' ) ;
4242
4343 // 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', () => {
8989 return TestBed . createComponent ( component ) ;
9090 }
9191
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+ } ) ) ;
9798
9899 describe ( 'panel toggling' , ( ) => {
99100 let fixture : ComponentFixture < SimpleAutocomplete > ;
@@ -598,6 +599,7 @@ describe('MatAutocomplete', () => {
598599 } ) ;
599600
600601 it ( 'should disable the input when used with a value accessor and without `matInput`' , ( ) => {
602+ overlayContainer . ngOnDestroy ( ) ;
601603 fixture . destroy ( ) ;
602604 TestBed . resetTestingModule ( ) ;
603605
Original file line number Diff line number Diff line change @@ -72,9 +72,12 @@ describe('MatMenu', () => {
7272 } ) ( ) ;
7373 } ) ) ;
7474
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 ( ) ;
7679 overlayContainer . ngOnDestroy ( ) ;
77- } ) ;
80+ } ) ) ;
7881
7982 it ( 'should open the menu as an idempotent operation' , ( ) => {
8083 const fixture = TestBed . createComponent ( SimpleMenu ) ;
Original file line number Diff line number Diff line change @@ -69,9 +69,12 @@ describe('MatTooltip', () => {
6969 } ) ( ) ;
7070 } ) ) ;
7171
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 ( ) ;
7376 overlayContainer . ngOnDestroy ( ) ;
74- } ) ;
77+ } ) ) ;
7578
7679 describe ( 'basic usage' , ( ) => {
7780 let fixture : ComponentFixture < BasicTooltipDemo > ;
You can’t perform that action at this time.
0 commit comments