Skip to content

chore: prevent ripple geometry test from running when iOS simulator fails to constrain window size #4510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/lib/core/ripple/ripple.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down