Skip to content

Commit 37591fa

Browse files
jelbournkara
authored andcommitted
chore: prevent geometry test from running when iOS simulator fails to (#4510)
constrain window size
1 parent 123d7ec commit 37591fa

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ describe('MdRipple', () => {
1818
let originalBodyMargin: string;
1919
let viewportRuler: ViewportRuler;
2020

21+
const startingWindowWidth = window.innerWidth;
22+
const startingWindowHeight = window.innerHeight;
23+
2124
beforeEach(() => {
2225
TestBed.configureTestingModule({
2326
imports: [MdRippleModule],
@@ -57,6 +60,15 @@ describe('MdRipple', () => {
5760
});
5861

5962
it('sizes ripple to cover element', () => {
63+
// In the iOS simulator (BrowserStack & SauceLabs), adding the content to the
64+
// body causes karma's iframe for the test to stretch to fit that content once we attempt to
65+
// scroll the page. Setting width / height / maxWidth / maxHeight on the iframe does not
66+
// successfully constrain its size. As such, skip assertions in environments where the
67+
// window size has changed since the start of the test.
68+
if (window.innerWidth > startingWindowWidth || window.innerHeight > startingWindowHeight) {
69+
return;
70+
}
71+
6072
let elementRect = rippleTarget.getBoundingClientRect();
6173

6274
// Dispatch a ripple at the following relative coordinates (X: 50| Y: 75)
@@ -192,9 +204,6 @@ describe('MdRipple', () => {
192204
});
193205

194206
describe('when page is scrolled', () => {
195-
const startingWindowWidth = window.innerWidth;
196-
const startingWindowHeight = window.innerHeight;
197-
198207
let veryLargeElement: HTMLDivElement = document.createElement('div');
199208
let pageScrollTop = 500;
200209
let pageScrollLeft = 500;

0 commit comments

Comments
 (0)