Skip to content

Commit fcc83ad

Browse files
crisbetojelbourn
authored andcommitted
chore(ripple): disable problematic test on iOS Safari (#2350)
Disables a problematic unit test that is currently failing on iOS Safari. Similar tests have also been disabled in the ViewportRuler.
1 parent c7b1ec5 commit fcc83ad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib/core/ripple/ripple.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ describe('MdRipple', () => {
210210
});
211211

212212
describe('when page is scrolled', () => {
213+
const startingWindowWidth = window.innerWidth;
214+
const startingWindowHeight = window.innerHeight;
213215
var veryLargeElement: HTMLDivElement = document.createElement('div');
214216
var pageScrollTop = 500;
215217
var pageScrollLeft = 500;
@@ -263,6 +265,16 @@ describe('MdRipple', () => {
263265
const expectedTop = top - expectedRadius;
264266

265267
const ripple = <HTMLElement>rippleElement.querySelector('.md-ripple-foreground');
268+
269+
// In the iOS simulator (BrowserStack & SauceLabs), adding the content to the
270+
// body causes karma's iframe for the test to stretch to fit that content once we attempt to
271+
// scroll the page. Setting width / height / maxWidth / maxHeight on the iframe does not
272+
// successfully constrain its size. As such, skip assertions in environments where the
273+
// window size has changed since the start of the test.
274+
if (window.innerWidth > startingWindowWidth || window.innerHeight > startingWindowHeight) {
275+
return;
276+
}
277+
266278
expect(pxStringToFloat(ripple.style.left)).toBeCloseTo(expectedLeft, 1);
267279
expect(pxStringToFloat(ripple.style.top)).toBeCloseTo(expectedTop, 1);
268280
expect(pxStringToFloat(ripple.style.width)).toBeCloseTo(2 * expectedRadius, 1);

0 commit comments

Comments
 (0)