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
Conversation
…tharva-amp-selector-fix
|
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.
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; |
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.
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
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.
Also, does it work if the event listener is attached on the document, or only on the container?
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.
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.
Created #31498 to get around CLA blocker. Closing this PR. |
Porting the feature from v0.1
Fixes #27082