-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🐛 Delay adding the ampshare fragment parameter until after the document is first visible #17237
Conversation
test/functional/test-viewer.js
Outdated
@@ -180,8 +182,10 @@ describe('Viewer', () => { | |||
const viewer = new Viewer(ampdoc); | |||
expect(viewer.getParam('test')).to.equal('1'); | |||
expect(viewer.isCctEmbedded()).to.be.true; | |||
expect(windowApi.history.replaceState).to.be.calledWith({}, '', | |||
'#test=1&share=http%3A%2F%2Fwww.example.com%2F'); | |||
return Promise.resolve(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be viewer.whenFirstVisible()
. If you change the test function from a closure to a generator function you can use yield
.
it('should merge fragments within custom tab', function*() {
...
yield viewer.whenFirstVisible();
expect(windowApi...);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! Much cleaner. Fixed!
Thanks for contributing! |
Unit tests are unexpectedly failing on this test:
I'm getting the same error on #17128. The amp-a4a test probably implicitly depends on order of test execution. 😢 I'll dig into this and merge when ready. /cc @rsimha |
The version of Edit: This is now done. |
@ryjust I fixed the issue in master. Can you merge latest and push? |
Everything is passing now. Thanks! |
When AMP CSI is enabled for CCT embedded documents, the hash fragment is updated by Chrome on click to include the click time. This process removes the ampshare parameter. The page becomes visible only after the fragment is updated so we need to delay adding the ampshare parameter until then.