Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2992,10 +2992,6 @@ describe('FlexibleConnectedPositionStrategy', () => {
});

it('should be able to opt into placing the overlay inside an adjacent popover element', () => {
if (!('showPopover' in document.body)) {
return;
}

attachOverlay({positionStrategy, usePopover: true});

expect(containerElement.contains(overlayRef.hostElement)).toBe(false);
Expand All @@ -3004,10 +3000,6 @@ describe('FlexibleConnectedPositionStrategy', () => {
});

it('should re-attach the popover next to the origin element', () => {
if (!('showPopover' in document.body)) {
return;
}

attachOverlay({positionStrategy, usePopover: true});
expect(originElement.nextElementSibling).toBe(overlayRef.hostElement);

Expand All @@ -3020,10 +3012,6 @@ describe('FlexibleConnectedPositionStrategy', () => {
});

it('should insert the overlay as a child of a custom element', () => {
if (!('showPopover' in document.body)) {
return;
}

positionStrategy.withPopoverLocation({type: 'parent', element: customHostElement});
attachOverlay({positionStrategy, usePopover: true});

Expand All @@ -3033,10 +3021,6 @@ describe('FlexibleConnectedPositionStrategy', () => {
});

it('should insert the overlay as a child of the origin', () => {
if (!('showPopover' in document.body)) {
return;
}

positionStrategy.withPopoverLocation({type: 'parent', element: originElement});
attachOverlay({positionStrategy, usePopover: true});

Expand Down
17 changes: 5 additions & 12 deletions src/material/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Direction} from '@angular/cdk/bidi';
import {DOWN_ARROW, ENTER, ESCAPE, SPACE, TAB, UP_ARROW} from '@angular/cdk/keycodes';
import {OverlayContainer, OverlayModule, createCloseScrollStrategy} from '@angular/cdk/overlay';
import {OverlayModule, createCloseScrollStrategy} from '@angular/cdk/overlay';
import {_supportsShadowDom} from '@angular/cdk/platform';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {
Expand Down Expand Up @@ -62,9 +62,6 @@ import {
} from './index';

describe('MatAutocomplete', () => {
const supportsPopover = 'showPopover' in document.body;
let overlayContainerElement: HTMLElement;

// Creates a test component fixture.
function createComponent<T>(component: Type<T>, providers: Provider[] = []) {
TestBed.configureTestingModule({
Expand All @@ -74,21 +71,17 @@ describe('MatAutocomplete', () => {
],
});

overlayContainerElement = TestBed.inject(OverlayContainer).getContainerElement();
return TestBed.createComponent<T>(component);
}

function getOverlayHost(fixture: ComponentFixture<unknown>): HTMLElement | null {
return supportsPopover
? fixture.nativeElement.querySelector('.cdk-overlay-popover')
: overlayContainerElement.querySelector('.cdk-overlay-connected-position-bounding-box');
return fixture.nativeElement.querySelector('.cdk-overlay-popover');
}

function getBackdrop(fixture: ComponentFixture<unknown>): HTMLElement | null {
const selector = '.cdk-overlay-backdrop';
return supportsPopover
? getOverlayHost(fixture)?.querySelector(selector) || null
: overlayContainerElement.querySelector(selector);
return (
fixture.nativeElement.querySelector('.cdk-overlay-popover .cdk-overlay-backdrop') || null
);
}

describe('panel toggling', () => {
Expand Down
14 changes: 3 additions & 11 deletions src/material/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TAB,
UP_ARROW,
} from '@angular/cdk/keycodes';
import {OverlayContainer, OverlayModule, createCloseScrollStrategy} from '@angular/cdk/overlay';
import {OverlayModule, createCloseScrollStrategy} from '@angular/cdk/overlay';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {
createKeyboardEvent,
Expand Down Expand Up @@ -76,7 +76,6 @@ import {
const DEFAULT_TYPEAHEAD_DEBOUNCE_INTERVAL = 200;

describe('MatSelect', () => {
const supportsPopover = 'showPopover' in document.body;
let dir: WritableSignal<Direction>;
let scrolledSubject = new Subject();

Expand All @@ -97,18 +96,11 @@ describe('MatSelect', () => {
});

function getOverlayHost(fixture: ComponentFixture<unknown>): HTMLElement | null {
return supportsPopover
? fixture.nativeElement.querySelector('.cdk-overlay-popover')
: TestBed.inject(OverlayContainer)
.getContainerElement()
.querySelector('.cdk-overlay-connected-position-bounding-box');
return fixture.nativeElement.querySelector('.cdk-overlay-popover');
}

function getBackdrop(fixture: ComponentFixture<unknown>): HTMLElement | null {
const parent = supportsPopover
? fixture.nativeElement
: TestBed.inject(OverlayContainer).getContainerElement();
return parent.querySelector('.cdk-overlay-backdrop');
return fixture.nativeElement.querySelector('.cdk-overlay-backdrop');
}

describe('core', () => {
Expand Down
Loading