Skip to content

Commit

Permalink
try w/o closewatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinmombay committed Jan 7, 2025
1 parent 88b887e commit ad0face
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion extensions/amp-lightbox/test-e2e/test-amp-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describes.endtoend(
).to.equal(641);
});

it('should close the lightbox', async () => {
// TODO(#40214): fix flaky test.
it.skip('should close the lightbox', async () => {
const open = await controller.findElement('#open');
await controller.click(open);

Expand Down
6 changes: 3 additions & 3 deletions src/utils/close-watcher-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {Keys_Enum} from '#core/constants/key-codes';

import {Services} from '#service';

import {dev, devAssert} from '#utils/log';
import {devAssert} from '#utils/log';

const TAG = 'CloseWatcherImpl';
//const TAG = 'CloseWatcherImpl';

export class CloseWatcherImpl {
/**
Expand All @@ -37,7 +37,7 @@ export class CloseWatcherImpl {

/** @private {?function()} */
this.boundCloseOnEscape_ = null;

if (typeof win.CloseWatcher === 'function') {
try {
this.watcher_ = new win.CloseWatcher();
Expand Down
6 changes: 6 additions & 0 deletions test/unit/utils/test-close-watcher-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ describes.realWin('#CloseWatcherImpl', {amp: true}, (env) => {
historyMock.verify();
});

it.configure().ifChrome().run('should call the handler on requestClose' , async () => {
const watcher = new CloseWatcherImpl(ampdoc, handler);
watcher.requestClose();
expect(handler).to.be.calledOnce;
});

// NOTE: Chrome supports the CloseWatcher API so we no longer use the History API.
it.configure()
.skipChrome()
Expand Down

0 comments on commit ad0face

Please sign in to comment.