Skip to content

Commit

Permalink
Testing if the multiFixture fails on IE
Browse files Browse the repository at this point in the history
  • Loading branch information
trshafer committed Apr 5, 2017
1 parent 59c6289 commit 1872bbf
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,34 +1040,38 @@ describe('MdSelect', () => {
select.style.marginRight = '20px';
});

it('should adjust for the checkbox in ltr', () => {
it('should adjust for the checkbox in ltr', async(() => {
trigger.click();
multiFixture.detectChanges();
multiFixture.whenStable().then(() => {

const triggerLeft = trigger.getBoundingClientRect().left;
const firstOptionLeft =
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().left;
const triggerLeft = trigger.getBoundingClientRect().left;
const firstOptionLeft =
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().left;

// 48px accounts for the checkbox size, margin and the panel's padding.
expect(firstOptionLeft.toFixed(2))
.toEqual((triggerLeft - 48).toFixed(2),
`Expected trigger label to align along x-axis, accounting for the checkbox.`);
});
// 48px accounts for the checkbox size, margin and the panel's padding.
expect(firstOptionLeft.toFixed(2))
.toEqual((triggerLeft - 48).toFixed(2),
`Expected trigger label to align along x-axis, accounting for the checkbox.`);
});
}));

it('should adjust for the checkbox in rtl', () => {
it('should adjust for the checkbox in rtl', async(() => {
dir.value = 'rtl';
trigger.click();
multiFixture.detectChanges();

const triggerRight = trigger.getBoundingClientRect().right;
const firstOptionRight =
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;
multiFixture.whenStable().then(() => {
const triggerRight = trigger.getBoundingClientRect().right;
const firstOptionRight =
document.querySelector('.cdk-overlay-pane md-option').getBoundingClientRect().right;

// 48px accounts for the checkbox size, margin and the panel's padding.
expect(firstOptionRight.toFixed(2))
.toEqual((triggerRight + 48).toFixed(2),
`Expected trigger label to align along x-axis, accounting for the checkbox.`);
});
// 48px accounts for the checkbox size, margin and the panel's padding.
expect(firstOptionRight.toFixed(2))
.toEqual((triggerRight + 48).toFixed(2),
`Expected trigger label to align along x-axis, accounting for the checkbox.`);
});
}));
});

});
Expand Down

0 comments on commit 1872bbf

Please sign in to comment.