Skip to content
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

✅ Fixes 2 unit tests #14561

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
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
19 changes: 17 additions & 2 deletions extensions/amp-analytics/0.1/test/test-amp-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,28 @@ describes.realWin('amp-analytics', {
}
});

// TODO(jonkeller, #14336): Fails due to console errors.
it.skip('does not unnecessarily preload iframe transport script', function() {
it('does not unnecessarily preload iframe transport script', function() {
const el = doc.createElement('amp-analytics');
el.setAttribute('type', 'foo');
doc.body.appendChild(el);
const analytics = new AmpAnalytics(el);
sandbox.stub(analytics, 'assertAmpAdResourceId').callsFake(() => 'fakeId');
const preloadSpy = sandbox.spy(analytics, 'preload');
sandbox.stub(analytics, 'predefinedConfig_').value(
{
'foo': {
'triggers': {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'sample_visibility_trigger': {
'on': 'visible',
'request': 'sample_visibility_request',
},
},
'requests': {
'sample_visibility_request': 'fake-request',
},
},
}
);
analytics.buildCallback();
analytics.preconnectCallback();
return analytics.layoutCallback().then(() => {
Expand Down
15 changes: 11 additions & 4 deletions extensions/amp-analytics/0.1/test/test-visibility-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,21 @@ describes.fakeWin('VisibilityManagerForDoc', {amp: true}, env => {
root.dispose();
});

// TODO(jonkeller, #14336): Fails due to console errors.
it.skip('does not allow min==max, when they are neither 0 nor 100', () => {
it('does not allow min==max, when they are neither 0 nor 100', () => {
let spec = {visiblePercentageThresholds: [[50, 50]]};
root.listenRoot(spec, null, null, null);
allowConsoleError(() => {
// Expect user().error(TAG,
// 'visiblePercentageThresholds entry invalid min/max value')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

root.listenRoot(spec, null, null, null);
});
expect(root.models_).to.have.length(0);
root.dispose();
spec = {visiblePercentageThresholds: [[0, 10], [10, 10], [30, 30]]};
root.listenRoot(spec, null, null, null);
allowConsoleError(() => {
// On the [10, 10] only, again expect user().error(TAG,
// 'visiblePercentageThresholds entry invalid min/max value')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

@jonkeller jonkeller Apr 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment should say "[10, 10] and [30, 30] only". I noticed this after it was merged, so corrected in #14576

root.listenRoot(spec, null, null, null);
});
expect(root.models_).to.have.length(1);
root.dispose();
});
Expand Down