Skip to content

Commit b049c8e

Browse files
committed
chore: try to fix edge tests
1 parent bcabda9 commit b049c8e

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/lib/select/select.spec.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
} from '../core/placeholder/placeholder-options';
3232

3333

34-
describe('MdSelect', () => {
34+
fdescribe('MdSelect', () => {
3535
let overlayContainerElement: HTMLElement;
3636
let dir: {value: 'ltr'|'rtl'};
3737
let scrolledSubject = new Subject();
@@ -1319,15 +1319,23 @@ describe('MdSelect', () => {
13191319
describe('x-axis positioning', () => {
13201320

13211321
beforeEach(() => {
1322+
<<<<<<< HEAD
13221323
select.style.position = 'fixed';
13231324
select.style.left = '30px';
13241325
});
13251326

13261327
it('should align the trigger and the selected option on the x-axis in ltr', fakeAsync(() => {
1328+
=======
1329+
select.style.marginLeft = select.style.marginRight = '50px';
1330+
});
1331+
1332+
it('should align the trigger and the selected option on the x-axis in ltr', async(() => {
1333+
>>>>>>> chore: try to fix edge tests
13271334
trigger.click();
13281335
tick(400);
13291336
fixture.detectChanges();
13301337

1338+
<<<<<<< HEAD
13311339
const triggerLeft = trigger.getBoundingClientRect().left;
13321340
const firstOptionLeft = document.querySelector('.cdk-overlay-pane md-option')
13331341
.getBoundingClientRect().left;
@@ -1339,13 +1347,30 @@ describe('MdSelect', () => {
13391347
}));
13401348

13411349
it('should align the trigger and the selected option on the x-axis in rtl', fakeAsync(() => {
1350+
=======
1351+
fixture.whenStable().then(() => {
1352+
const triggerLeft = trigger.getBoundingClientRect().left;
1353+
const firstOptionLeft =
1354+
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().left;
1355+
1356+
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1357+
// to ensure the text overlaps correctly.
1358+
expect(firstOptionLeft.toFixed(2))
1359+
.toEqual((triggerLeft - 16).toFixed(2),
1360+
`Expected trigger to align with the selected option on the x-axis in LTR.`);
1361+
});
1362+
}));
1363+
1364+
it('should align the trigger and the selected option on the x-axis in rtl', async(() => {
1365+
>>>>>>> chore: try to fix edge tests
13421366
dir.value = 'rtl';
13431367
fixture.detectChanges();
13441368

13451369
trigger.click();
13461370
tick(400);
13471371
fixture.detectChanges();
13481372

1373+
<<<<<<< HEAD
13491374
const triggerRight = trigger.getBoundingClientRect().right;
13501375
const firstOptionRight =
13511376
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;
@@ -1468,6 +1493,21 @@ describe('MdSelect', () => {
14681493
expect(Math.floor(selectedOptionLeft)).toEqual(Math.floor(triggerLeft - 16));
14691494
}));
14701495

1496+
=======
1497+
fixture.whenStable().then(() => {
1498+
const triggerRight = trigger.getBoundingClientRect().right;
1499+
const firstOptionRight =
1500+
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;
1501+
1502+
// Each option is 32px wider than the trigger, so it must be adjusted 16px
1503+
// to ensure the text overlaps correctly.
1504+
expect(firstOptionRight.toFixed(2))
1505+
.toEqual((triggerRight + 16).toFixed(2),
1506+
`Expected trigger to align with the selected option on the x-axis in RTL.`);
1507+
});
1508+
}));
1509+
1510+
>>>>>>> chore: try to fix edge tests
14711511
});
14721512

14731513
describe('with header', () => {

0 commit comments

Comments
 (0)