Skip to content

Improve visibility event tests#26847

Merged
micajuine-ho merged 2 commits intoampproject:masterfrom
micajuine-ho:fix_visibilityTests
Feb 28, 2020
Merged

Improve visibility event tests#26847
micajuine-ho merged 2 commits intoampproject:masterfrom
micajuine-ho:fix_visibilityTests

Conversation

@micajuine-ho
Copy link
Copy Markdown
Contributor

@micajuine-ho micajuine-ho commented Feb 18, 2020

Changing function* to async and removing unlisten

expect(event.type).to.equal('visible');
expect(event.vars.totalVisibleTime).to.equal(10);
expect(unlisten).to.be.not.called;
await res();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test checks if the unlistener from tracker.add() is called afterward but invoking res() calls the unlistener manually. Please fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As discussed offline, we will remove the check for unlisten (because it doesn't have too much value)

@micajuine-ho micajuine-ho requested a review from zhouyx February 27, 2020 23:43
config,
eventResolver
);
expect(res).to.be.a('function');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll say checking the return value of add is a function is still valuable because it prevent cases where one fail to return an unlistener.

@micajuine-ho micajuine-ho merged commit 0f740a4 into ampproject:master Feb 28, 2020
robinvanopstal added a commit to jungvonmatt/amphtml that referenced this pull request Mar 2, 2020
* master:
  Launch `amp-next-page` v2 & clean up experiment (ampproject#27035)
  ✨Implement Display Locking on amp-accordion (ampproject#25867)
  📖<amp-next-page> documentation and validation (ampproject#26841)
  Improve visibility event tests (ampproject#26847)
  amp-geo: Fall back to API for country (ampproject#26407)
  ✨ Add customization options to <amp-story-quiz> (ampproject#26714)
  navigation: Minor test improvements (ampproject#26926)
  ♻️ Alias video.fullscreen action for symmetry with interface names (ampproject#27017)
  ✨ Implements `amp-analytics` support for `amp-next-page` (ampproject#26451)
  ✨ amp-video-iframe integration: global jwplayer() singleton by default (ampproject#26969)
  Fix unit tests broken by ampproject#26687 (ampproject#27000)
  Filter redirect info from emails (ampproject#27012)
  📖 Make amp-bind doc valid, fix amp-form stories filter (ampproject#27003)
  url-replacements: Minor test improvement (ampproject#26930)
  viewport: Minor test improvement (ampproject#26931)
  amp-consent fullscreen warning (ampproject#26467)
  dep-check: USE CAPS FOR IMPORTANCE (ampproject#26993)
  fix img url (ampproject#26987)

# Conflicts:
#	extensions/amp-next-page/amp-next-page.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants