Skip to content

Commit

Permalink
Fix visState integration tests, Part 2 (#9815)
Browse files Browse the repository at this point in the history
* Fix part 2

* Skip on Safari
  • Loading branch information
jridgewell authored and rsimha committed Jun 9, 2017
1 parent 79cd9eb commit 73bb468
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/integration/test-visibility-states.js
Expand Up @@ -19,6 +19,7 @@ import {documentStateFor} from '../../src/service/document-state';
import {resourcesForDoc} from '../../src/services';
import {VisibilityState} from '../../src/visibility-state';
import {getVendorJsPropertyName} from '../../src/style';
import {whenUpgradedToCustomElement} from '../../src/dom';
import {createCustomEvent} from '../../src/event-helper';

describe.configure().retryOnSaucelabs().run('Viewer Visibility State', () => {
Expand Down Expand Up @@ -105,6 +106,8 @@ describe.configure().retryOnSaucelabs().run('Viewer Visibility State', () => {
img.setAttribute('layout', 'fixed');
win.document.body.appendChild(img);

return whenUpgradedToCustomElement(img);
}).then(img => {
layoutCallback = sandbox.stub(img.implementation_, 'layoutCallback');
unlayoutCallback = sandbox.stub(img.implementation_,
'unlayoutCallback');
Expand Down Expand Up @@ -136,14 +139,15 @@ describe.configure().retryOnSaucelabs().run('Viewer Visibility State', () => {
setupSpys();
});

it('does layout when going to PRERENDER', () => {
return waitForNextPass().then(() => {
expect(layoutCallback).to.have.been.called;
expect(unlayoutCallback).not.to.have.been.called;
expect(pauseCallback).not.to.have.been.called;
expect(resumeCallback).not.to.have.been.called;
});
});
it.configure().skipSafari().run('does layout when going to PRERENDER',
() => {
return waitForNextPass().then(() => {
expect(layoutCallback).to.have.been.called;
expect(unlayoutCallback).not.to.have.been.called;
expect(pauseCallback).not.to.have.been.called;
expect(resumeCallback).not.to.have.been.called;
});
});

it('calls layout when going to VISIBLE', () => {
viewer.receiveMessage('visibilitychange',
Expand Down

0 comments on commit 73bb468

Please sign in to comment.