Skip to content

Commit bea22ae

Browse files
committed
chore: try to fix edge tests
1 parent 04f1c07 commit bea22ae

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

src/lib/select/select.spec.ts

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from '@angular/forms';
2020
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
2121

22-
describe('MdSelect', () => {
22+
fdescribe('MdSelect', () => {
2323
let overlayContainerElement: HTMLElement;
2424
let dir: {value: string};
2525

@@ -990,41 +990,44 @@ describe('MdSelect', () => {
990990
describe('x-axis positioning', () => {
991991

992992
beforeEach(() => {
993-
select.style.marginLeft = '20px';
994-
select.style.marginRight = '20px';
993+
select.style.marginLeft = select.style.marginRight = '50px';
995994
});
996995

997-
it('should align the trigger and the selected option on the x-axis in ltr', () => {
996+
it('should align the trigger and the selected option on the x-axis in ltr', async(() => {
998997
trigger.click();
999998
fixture.detectChanges();
1000999

1001-
const triggerLeft = trigger.getBoundingClientRect().left;
1002-
const firstOptionLeft =
1003-
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().left;
1004-
1005-
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1006-
// to ensure the text overlaps correctly.
1007-
expect(firstOptionLeft.toFixed(2))
1008-
.toEqual((triggerLeft - 16).toFixed(2),
1009-
`Expected trigger to align with the selected option on the x-axis in LTR.`);
1010-
});
1000+
fixture.whenStable().then(() => {
1001+
const triggerLeft = trigger.getBoundingClientRect().left;
1002+
const firstOptionLeft =
1003+
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().left;
1004+
1005+
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1006+
// to ensure the text overlaps correctly.
1007+
expect(firstOptionLeft.toFixed(2))
1008+
.toEqual((triggerLeft - 16).toFixed(2),
1009+
`Expected trigger to align with the selected option on the x-axis in LTR.`);
1010+
});
1011+
}));
10111012

1012-
it('should align the trigger and the selected option on the x-axis in rtl', () => {
1013+
it('should align the trigger and the selected option on the x-axis in rtl', async(() => {
10131014
dir.value = 'rtl';
10141015

10151016
trigger.click();
10161017
fixture.detectChanges();
10171018

1018-
const triggerRight = trigger.getBoundingClientRect().right;
1019-
const firstOptionRight =
1020-
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;
1021-
1022-
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1023-
// to ensure the text overlaps correctly.
1024-
expect(firstOptionRight.toFixed(2))
1025-
.toEqual((triggerRight + 16).toFixed(2),
1026-
`Expected trigger to align with the selected option on the x-axis in RTL.`);
1027-
});
1019+
fixture.whenStable().then(() => {
1020+
const triggerRight = trigger.getBoundingClientRect().right;
1021+
const firstOptionRight =
1022+
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;
1023+
1024+
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1025+
// to ensure the text overlaps correctly.
1026+
expect(firstOptionRight.toFixed(2))
1027+
.toEqual((triggerRight + 16).toFixed(2),
1028+
`Expected trigger to align with the selected option on the x-axis in RTL.`);
1029+
});
1030+
}));
10281031

10291032
});
10301033

0 commit comments

Comments
 (0)