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

✨ [amp-carousel]: Expose ampTrust in slideChange event #31487

Closed
wants to merge 12 commits into from

Conversation

dmanek
Copy link
Contributor

@dmanek dmanek commented Dec 7, 2020

Porting the feature from v0.1

Fixes #27082

@dmanek dmanek requested a review from caroqliu December 7, 2020 22:48
@CLAassistant
Copy link

CLAassistant commented Dec 7, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ dmanek
❌ AtharvaSune
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@caroqliu caroqliu left a comment

Choose a reason for hiding this comment

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

LGTM with one ask, thank you!


it('should dispatch event with index and actionTrust when changing slides', async () => {
container.addEventListener('slideChange', (event) => {
const {index, actionTrust} = event.data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you do one of these:

  • Assert the event has been emitted the expected number of times after afterIndexUpdate, either with a flag or by counting the events
  • Give a spy as the event listener callback and count calls / assert arguments have this shape

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, does it work if the event listener is attached on the document, or only on the container?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The event listener is attached on the container and because of that, I cannot count the event using win.document.eventListeners.count('slideChange') statement (doesn't work on the container element). Used the counter approach as discussed offline. Also I removed the should dispatch when changing slides test since this test is a superset of that.

@dmanek
Copy link
Contributor Author

dmanek commented Dec 8, 2020

Created #31498 to get around CLA blocker. Closing this PR.

@dmanek dmanek closed this Dec 8, 2020
@dmanek dmanek deleted the amp-carousel-action-trust branch December 8, 2020 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose ampTrust property with amp-carousel v2 slideChange event
4 participants