Skip to content

Commit b63f612

Browse files
committed
fix: failing test on IE11
1 parent 51e2ead commit b63f612

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

src/lib/select/select.spec.ts

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FakeViewportRuler {
3636
}
3737
}
3838

39-
describe('MdSelect', () => {
39+
fdescribe('MdSelect', () => {
4040
let overlayContainerElement: HTMLElement;
4141
let dir: {value: 'ltr'|'rtl'};
4242
let fakeViewportRuler = new FakeViewportRuler();
@@ -932,68 +932,64 @@ describe('MdSelect', () => {
932932
});
933933

934934
describe('limited space to open horizontally', () => {
935-
beforeEach(async(() => {
935+
beforeEach(() => {
936936
select.style.position = 'absolute';
937937
select.style.top = '200px';
938-
}));
938+
});
939939

940-
it('should stay within the viewport when overflowing on the left in ltr', async(() => {
940+
it('should stay within the viewport when overflowing on the left in ltr', fakeAsync(() => {
941941
select.style.left = '-100px';
942942
trigger.click();
943+
tick(400);
943944
fixture.detectChanges();
944945

945-
fixture.whenStable().then(() => {
946-
const panelLeft = document.querySelector('.mat-select-panel')
947-
.getBoundingClientRect().left;
948-
expect(panelLeft).toBeGreaterThan(0,
949-
`Expected select panel to be inside the viewport in ltr.`);
950-
});
946+
const panelLeft = document.querySelector('.mat-select-panel')
947+
.getBoundingClientRect().left;
948+
expect(panelLeft).toBeGreaterThan(0,
949+
`Expected select panel to be inside the viewport in ltr.`);
951950
}));
952951

953-
it('should stay within the viewport when overflowing on the right in rtl', async(() => {
952+
it('should stay within the viewport when overflowing on the left in rtl', fakeAsync(() => {
954953
dir.value = 'rtl';
955954
select.style.left = '-100px';
956955
trigger.click();
956+
tick(400);
957957
fixture.detectChanges();
958958

959-
fixture.whenStable().then(() => {
960-
const panelLeft = document.querySelector('.mat-select-panel')
961-
.getBoundingClientRect().left;
959+
const panelLeft = document.querySelector('.mat-select-panel')
960+
.getBoundingClientRect().left;
962961

963-
expect(panelLeft).toBeGreaterThan(0,
964-
`Expected select panel to be inside the viewport in rtl.`);
965-
});
962+
expect(panelLeft).toBeGreaterThan(0,
963+
`Expected select panel to be inside the viewport in rtl.`);
966964
}));
967965

968-
it('should stay within the viewport when overflowing on the right in ltr', async(() => {
966+
it('should stay within the viewport when overflowing on the right in ltr', fakeAsync(() => {
969967
select.style.right = '-100px';
970968
trigger.click();
969+
tick(400);
971970
fixture.detectChanges();
972971

973-
fixture.whenStable().then(() => {
974-
const viewportRect = fakeViewportRuler.getViewportRect().right;
975-
const panelRight = document.querySelector('.mat-select-panel')
976-
.getBoundingClientRect().right;
972+
const viewportRect = fakeViewportRuler.getViewportRect().right;
973+
const panelRight = document.querySelector('.mat-select-panel')
974+
.getBoundingClientRect().right;
977975

978-
expect(viewportRect - panelRight).toBeGreaterThan(0,
979-
`Expected select panel to be inside the viewport in ltr.`);
980-
});
976+
expect(viewportRect - panelRight).toBeGreaterThan(0,
977+
`Expected select panel to be inside the viewport in ltr.`);
981978
}));
982979

983-
it('should stay within the viewport when overflowing on the right in rtl', async(() => {
980+
it('should stay within the viewport when overflowing on the right in rtl', fakeAsync(() => {
984981
dir.value = 'rtl';
985982
select.style.right = '-100px';
986983
trigger.click();
984+
tick(400);
987985
fixture.detectChanges();
988986

989-
fixture.whenStable().then(() => {
990-
const viewportRect = fakeViewportRuler.getViewportRect().right;
991-
const panelRight = document.querySelector('.mat-select-panel')
992-
.getBoundingClientRect().right;
987+
const viewportRect = fakeViewportRuler.getViewportRect().right;
988+
const panelRight = document.querySelector('.mat-select-panel')
989+
.getBoundingClientRect().right;
993990

994-
expect(viewportRect - panelRight).toBeGreaterThan(0,
995-
`Expected select panel to be inside the viewport in rtl.`);
996-
});
991+
expect(viewportRect - panelRight).toBeGreaterThan(0,
992+
`Expected select panel to be inside the viewport in rtl.`);
997993
}));
998994

999995
it('should keep the position within the viewport on repeat openings', async(() => {
@@ -1017,6 +1013,7 @@ describe('MdSelect', () => {
10171013
`Expected select panel continue being inside the viewport.`);
10181014
});
10191015
}));
1016+
10201017
});
10211018

10221019
describe('when scrolled', () => {

0 commit comments

Comments
 (0)