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

Instantiate the amp-story element only once per test. #18142

Merged
merged 1 commit into from Sep 18, 2018

Conversation

gmajoulet
Copy link
Contributor

In the beforeEach statement of test-amp-story, we were doing:

element = win.document.createElement('amp-story'); // Creates an AmpStory instance
story = new AmpStory(element); // Also creates an AmpStory instance

Having two instances of AmpStory was bringing different side effects:

  • the second AmpStory buildCallback wasn't called by the runtime, which is why this PR is removing the buildCallback that were manually added
  • listeners would get triggered twice

This PR ensures we only instantiate AmpStory once.

@gmajoulet gmajoulet merged commit 35e427c into ampproject:master Sep 18, 2018
torch2424 pushed a commit to torch2424/amphtml that referenced this pull request Sep 20, 2018
torch2424 pushed a commit to torch2424/amphtml that referenced this pull request Oct 10, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants