diff --git a/src/lib/core/ripple/ripple.spec.ts b/src/lib/core/ripple/ripple.spec.ts index ef2330601ad4..15ca947f54fd 100644 --- a/src/lib/core/ripple/ripple.spec.ts +++ b/src/lib/core/ripple/ripple.spec.ts @@ -18,6 +18,9 @@ describe('MdRipple', () => { let originalBodyMargin: string; let viewportRuler: ViewportRuler; + const startingWindowWidth = window.innerWidth; + const startingWindowHeight = window.innerHeight; + beforeEach(() => { TestBed.configureTestingModule({ imports: [MdRippleModule], @@ -57,6 +60,15 @@ describe('MdRipple', () => { }); it('sizes ripple to cover element', () => { + // In the iOS simulator (BrowserStack & SauceLabs), adding the content to the + // body causes karma's iframe for the test to stretch to fit that content once we attempt to + // scroll the page. Setting width / height / maxWidth / maxHeight on the iframe does not + // successfully constrain its size. As such, skip assertions in environments where the + // window size has changed since the start of the test. + if (window.innerWidth > startingWindowWidth || window.innerHeight > startingWindowHeight) { + return; + } + let elementRect = rippleTarget.getBoundingClientRect(); // Dispatch a ripple at the following relative coordinates (X: 50| Y: 75) @@ -192,9 +204,6 @@ describe('MdRipple', () => { }); describe('when page is scrolled', () => { - const startingWindowWidth = window.innerWidth; - const startingWindowHeight = window.innerHeight; - let veryLargeElement: HTMLDivElement = document.createElement('div'); let pageScrollTop = 500; let pageScrollLeft = 500;