diff --git a/CHANGELOG.md b/CHANGELOG.md index f2d0b021d..b6aed9df4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.12.1 (2018-04-26) + +- Fixed dropdown repositioning slowness. [#1655](https://github.com/blackbaud/skyux2/pull/1655) + # 2.12.0 (2018-04-23) - Added select field component. [#1629](https://github.com/blackbaud/skyux2/pull/1629) (Thanks @Blackbaud-JaminQuimby) diff --git a/package.json b/package.json index a2bc9789b..ca01187e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blackbaud/skyux", - "version": "2.12.0", + "version": "2.12.1", "description": "SKY UX built on Angular 2", "author": "Blackbaud, Inc.", "homepage": "https://github.com/blackbaud/skyux2", diff --git a/src/modules/dropdown/dropdown.component.spec.ts b/src/modules/dropdown/dropdown.component.spec.ts index fc4e399d2..2c9227319 100644 --- a/src/modules/dropdown/dropdown.component.spec.ts +++ b/src/modules/dropdown/dropdown.component.spec.ts @@ -1,5 +1,4 @@ import { - async, ComponentFixture, fakeAsync, TestBed, @@ -23,19 +22,20 @@ describe('Dropdown component', () => { let fixture: ComponentFixture; let component: DropdownTestComponent; - beforeEach(async(() => { + beforeEach(() => { TestBed.configureTestingModule({ imports: [ SkyDropdownFixturesModule ] - }).compileComponents(); - })); - - beforeEach(() => { + }); fixture = TestBed.createComponent(DropdownTestComponent); component = fixture.componentInstance; }); + afterEach(() => { + fixture.destroy(); + }); + function openPopoverWithButtonClick() { tick(); fixture.detectChanges(); diff --git a/src/modules/dropdown/dropdown.component.ts b/src/modules/dropdown/dropdown.component.ts index b37fc0bd8..628bed36a 100644 --- a/src/modules/dropdown/dropdown.component.ts +++ b/src/modules/dropdown/dropdown.component.ts @@ -193,7 +193,9 @@ export class SkyDropdownComponent implements OnInit, OnDestroy { case SkyDropdownMessageType.Reposition: // Only reposition the dropdown if it is already open. if (this.isOpen) { - this.popover.reposition(); + this.windowRef.getWindow().setTimeout(() => { + this.popover.reposition(); + }); } break; diff --git a/src/modules/popover/popover.component.spec.ts b/src/modules/popover/popover.component.spec.ts index d1e35816b..31ad5b1a3 100644 --- a/src/modules/popover/popover.component.spec.ts +++ b/src/modules/popover/popover.component.spec.ts @@ -325,7 +325,7 @@ describe('SkyPopoverComponent', () => { })); it('should expose a method to return the placement to the preferred placement', fakeAsync(() => { - spyOn(mockAdapterService, 'getPopoverPosition').and.returnValue({ + const spy = spyOn(mockAdapterService, 'getPopoverPosition').and.returnValue({ top: 0, left: 0, arrowLeft: 0, @@ -342,8 +342,7 @@ describe('SkyPopoverComponent', () => { expect(component.placement).toEqual('right'); component.reposition(); - expect(component.placement).toEqual('above'); - tick(); + expect(spy.calls.argsFor(1)[1]).toEqual('above'); })); it('should hide the popover if its top or bottom boundaries leave its scrollable parent', fakeAsync(() => { diff --git a/src/modules/popover/popover.component.ts b/src/modules/popover/popover.component.ts index ff49c5eea..0dfbc6bcd 100644 --- a/src/modules/popover/popover.component.ts +++ b/src/modules/popover/popover.component.ts @@ -160,13 +160,11 @@ export class SkyPopoverComponent implements OnInit, OnDestroy { this.placement = this.preferredPlacement; this.changeDetector.markForCheck(); - this.windowRef.getWindow().setTimeout(() => { - if (this.adapterService.isPopoverLargerThanParent(this.popoverContainer)) { - this.placement = 'fullscreen'; - } + if (this.adapterService.isPopoverLargerThanParent(this.popoverContainer)) { + this.placement = 'fullscreen'; + } - this.positionPopover(); - }); + this.positionPopover(); } public close() { diff --git a/src/modules/timepicker/timepicker-component.spec.ts b/src/modules/timepicker/timepicker-component.spec.ts index 36f43dd74..27ef3dd72 100644 --- a/src/modules/timepicker/timepicker-component.spec.ts +++ b/src/modules/timepicker/timepicker-component.spec.ts @@ -129,9 +129,10 @@ describe('Timepicker', () => { const closeButton = fixture.nativeElement.querySelector('.sky-timepicker-footer button'); closeButton.click(); tick(); + fixture.detectChanges(); tick(); - const dropdown = fixture.nativeElement.querySelector('.sky-popover-container') as HTMLElement; - expect(dropdown.classList.contains('sky-popover-hidden')).toEqual(false); + const hiddenPopover = fixture.nativeElement.querySelector('.sky-popover-hidden') as HTMLElement; + expect(hiddenPopover).not.toBeNull(); })); it('should handle input change with a string with the expected timeFormat', fakeAsync(() => {