Skip to content

Commit

Permalink
Use static enum linting with AutoLightboxEvents (#36781)
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Nov 5, 2021
1 parent 70f7567 commit e973ab9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions extensions/amp-auto-lightbox/0.1/amp-auto-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -424,7 +424,7 @@ export function apply(ampdoc, element) {
REQUIRED_EXTENSION
);

dispatchCustomEvent(element, AutoLightboxEvents.NEWLY_SET);
dispatchCustomEvent(element, AutoLightboxEvents_Enum.NEWLY_SET);

return element;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from './lightbox-placeholders';

import {
AutoLightboxEvents,
AutoLightboxEvents_Enum,
isActionableByTap,
} from '../../../../src/auto-lightbox';

Expand Down Expand Up @@ -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));
});
Expand Down
2 changes: 1 addition & 1 deletion src/auto-lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit e973ab9

Please sign in to comment.