mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: overlay container not being cleaned up in global overlay tests (#9878)
* Fixes the `GlobalPositionStrategy` tests leaking `.cdk-overlay-container` instances which can cause flakes in other tests. * Fixes a wrong method name in the bottom sheet overview.
This commit is contained in:
committed by
mmalerba
parent
008ee07ce8
commit
762088741a
@@ -2,7 +2,7 @@ import {NgModule, NgZone, Component} from '@angular/core';
|
||||
import {TestBed, inject} from '@angular/core/testing';
|
||||
import {MockNgZone} from '@angular/cdk/testing';
|
||||
import {PortalModule, ComponentPortal} from '@angular/cdk/portal';
|
||||
import {OverlayModule, Overlay, OverlayConfig, OverlayRef} from '../index';
|
||||
import {OverlayModule, Overlay, OverlayConfig, OverlayRef, OverlayContainer} from '../index';
|
||||
|
||||
|
||||
describe('GlobalPositonStrategy', () => {
|
||||
@@ -21,12 +21,14 @@ describe('GlobalPositonStrategy', () => {
|
||||
})();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
afterEach(inject([OverlayContainer], (overlayContainer: OverlayContainer) => {
|
||||
if (overlayRef) {
|
||||
overlayRef.dispose();
|
||||
overlayRef = null!;
|
||||
}
|
||||
});
|
||||
|
||||
overlayContainer.ngOnDestroy();
|
||||
}));
|
||||
|
||||
function attachOverlay(config: OverlayConfig): OverlayRef {
|
||||
const portal = new ComponentPortal(BlankPortal);
|
||||
|
||||
@@ -24,7 +24,7 @@ export class BottomSheetOverviewExample {
|
||||
export class BottomSheetOverviewExampleSheet {
|
||||
constructor(private bottomSheetRef: MatBottomSheetRef<BottomSheetOverviewExampleSheet>) {}
|
||||
|
||||
onNoClick(event: MouseEvent): void {
|
||||
openLink(event: MouseEvent): void {
|
||||
this.bottomSheetRef.dismiss();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user