Skip to content

Commit

Permalink
Fixed IE10 problem?
Browse files Browse the repository at this point in the history
  • Loading branch information
Buchheit committed Apr 25, 2018
1 parent efc5183 commit 52896ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
8 changes: 4 additions & 4 deletions packages/popper/src/utils/getWindowSizes.js
Expand Up @@ -8,10 +8,10 @@ function getSize(axis, body, html, computedStyle) {
html[`offset${axis}`],
html[`scroll${axis}`],
isIE(10)
? html[`offset${axis}`] +
computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`] +
computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`]
: 0
? (parseInt(html[`offset${axis}`]) +
parseInt(computedStyle[`margin${axis === 'Height' ? 'Top' : 'Left'}`]) +
parseInt(computedStyle[`margin${axis === 'Height' ? 'Bottom' : 'Right'}`]))
: 0
);
}

Expand Down
46 changes: 20 additions & 26 deletions packages/popper/tests/unit/getBoundaries.js
Expand Up @@ -67,38 +67,32 @@ describe('utils/getBoundaries', () => {
});

it('returns a boundary defined by the document element.', () => {
if(!isIE(10)) { //Test does not work with IE 10
const result = getBoundaries(popper, node, 0, 'window', true);
expectBoundary(result, {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0,
});
}
const result = getBoundaries(popper, node, 0, 'window', true);
expectBoundary(result, {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0,
});
});

it('returns a boundary defined by the document element by way of a child reference.', () => {
if(!isIE(10)) { //Test does not work with IE 10
const result = getBoundaries(popper, spacing, 0, 'scrollParent', true);
expectBoundary(result, {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0,
});
}
const result = getBoundaries(popper, spacing, 0, 'scrollParent', true);
expectBoundary(result, {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0,
});
});

it('returns a custom defined boundary within the page.', () => {
if(!isIE(10) && !isIE(11)) { //Test does not work with IE 10 or IE 11
const result = getBoundaries(scrollingPopper, scrollingChild, 0, 'scrollParent', true);
expectBoundary(result, {
top: -150,
right: window.innerWidth - 160,
bottom: window.innerHeight - 150,
left: -160,
});
}
expectBoundary(result, {
top: -150,
right: window.innerWidth - 160,
bottom: window.innerHeight - 150,
left: -160,
});
});
});

0 comments on commit 52896ee

Please sign in to comment.