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
36 changes: 36 additions & 0 deletions src/cdk/overlay/overlay-directives.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ describe('Overlay directives', () => {

const pane = overlayContainerElement.children[0] as HTMLElement;
expect(pane.style.width).toEqual('250px');

fixture.componentInstance.isOpen = false;
fixture.detectChanges();

fixture.componentInstance.width = 500;
fixture.componentInstance.isOpen = true;
fixture.detectChanges();

expect(pane.style.width).toEqual('500px');
});

it('should set the height', () => {
Expand All @@ -149,6 +158,15 @@ describe('Overlay directives', () => {

const pane = overlayContainerElement.children[0] as HTMLElement;
expect(pane.style.height).toEqual('100vh');

fixture.componentInstance.isOpen = false;
fixture.detectChanges();

fixture.componentInstance.height = '50vh';
fixture.componentInstance.isOpen = true;
fixture.detectChanges();

expect(pane.style.height).toEqual('50vh');
});

it('should set the min width', () => {
Expand All @@ -158,6 +176,15 @@ describe('Overlay directives', () => {

const pane = overlayContainerElement.children[0] as HTMLElement;
expect(pane.style.minWidth).toEqual('250px');

fixture.componentInstance.isOpen = false;
fixture.detectChanges();

fixture.componentInstance.minWidth = 500;
fixture.componentInstance.isOpen = true;
fixture.detectChanges();

expect(pane.style.minWidth).toEqual('500px');
});

it('should set the min height', () => {
Expand All @@ -167,6 +194,15 @@ describe('Overlay directives', () => {

const pane = overlayContainerElement.children[0] as HTMLElement;
expect(pane.style.minHeight).toEqual('500px');

fixture.componentInstance.isOpen = false;
fixture.detectChanges();

fixture.componentInstance.minHeight = '250px';
fixture.componentInstance.isOpen = true;
fixture.detectChanges();

expect(pane.style.minHeight).toEqual('250px');
});

it('should create the backdrop if designated', () => {
Expand Down
8 changes: 8 additions & 0 deletions src/cdk/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ export class CdkConnectedOverlay implements OnDestroy, OnChanges {
this._detachOverlay();
}
});
} else {
// Update the overlay size, in case the directive's inputs have changed
this._overlayRef.updateSize({
width: this.width,
minWidth: this.minWidth,
height: this.height,
minHeight: this.minHeight,
});
}

this._position.withDirection(this.dir);
Expand Down