From 18ea178ed8fc8fe797da21b3d734c40768621f0e Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Thu, 4 Nov 2021 18:29:52 -0400 Subject: [PATCH] Use static enum linting with AutoLightboxEvents --- extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js | 4 ++-- .../amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js | 4 ++-- .../amp-lightbox-gallery/0.1/service/lightbox-manager-impl.js | 4 ++-- src/auto-lightbox.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js b/extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js index 52de8408fb72..b6a5dedbd4af 100644 --- a/extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js +++ b/extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js @@ -20,7 +20,7 @@ import {Services} from '#service'; import {loadPromise} from '#utils/event-helper'; import {dev} from '#utils/log'; -import {AutoLightboxEvents} from '../../../src/auto-lightbox'; +import {AutoLightboxEvents_Enum} from '../../../src/auto-lightbox'; const TAG = 'amp-auto-lightbox'; @@ -424,7 +424,7 @@ export function apply(ampdoc, element) { REQUIRED_EXTENSION ); - dispatchCustomEvent(element, AutoLightboxEvents.NEWLY_SET); + dispatchCustomEvent(element, AutoLightboxEvents_Enum.NEWLY_SET); return element; }); diff --git a/extensions/amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js b/extensions/amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js index cd25d8dc820f..8e3d75f3fb70 100644 --- a/extensions/amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js +++ b/extensions/amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js @@ -7,7 +7,7 @@ import {isArray} from '#core/types'; import {Services} from '#service'; -import {AutoLightboxEvents} from '../../../../src/auto-lightbox'; +import {AutoLightboxEvents_Enum} from '../../../../src/auto-lightbox'; import { Criteria, DocMetaAnnotations, @@ -766,7 +766,7 @@ describes.realWin( `; const eventSpy = env.sandbox.spy(); - element.addEventListener(AutoLightboxEvents.NEWLY_SET, eventSpy); + element.addEventListener(AutoLightboxEvents_Enum.NEWLY_SET, eventSpy); await apply(env.ampdoc, element); expect(eventSpy).to.be.calledOnce; diff --git a/extensions/amp-lightbox-gallery/0.1/service/lightbox-manager-impl.js b/extensions/amp-lightbox-gallery/0.1/service/lightbox-manager-impl.js index d12240ab86b7..dd870b3ec507 100644 --- a/extensions/amp-lightbox-gallery/0.1/service/lightbox-manager-impl.js +++ b/extensions/amp-lightbox-gallery/0.1/service/lightbox-manager-impl.js @@ -22,7 +22,7 @@ import { } from './lightbox-placeholders'; import { - AutoLightboxEvents, + AutoLightboxEvents_Enum, isActionableByTap, } from '../../../../src/auto-lightbox'; @@ -133,7 +133,7 @@ export class LightboxManager { }); // Process elements where the `lightbox` attr is dynamically set. - root.addEventListener(AutoLightboxEvents.NEWLY_SET, (e) => { + root.addEventListener(AutoLightboxEvents_Enum.NEWLY_SET, (e) => { const {target} = e; this.processLightboxElement_(dev().assertElement(target)); }); diff --git a/src/auto-lightbox.js b/src/auto-lightbox.js index 214082f70015..433c9aa67b5c 100644 --- a/src/auto-lightbox.js +++ b/src/auto-lightbox.js @@ -8,7 +8,7 @@ import {ChunkPriority, chunk} from './chunk'; import {isStoryDocument} from './utils/story'; /** @const @enum {string} */ -export const AutoLightboxEvents = { +export const AutoLightboxEvents_Enum = { // Triggered when the lightbox attribute is newly set on an item in order to // process by the renderer extension (e.g. amp-lightbox-gallery). NEWLY_SET: 'amp-auto-lightbox:newly-set',