Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit a76fa79

Browse files
committed
WIP: Replace remaining hard-coded strings with fully-qualified enum refs
1 parent 8ce644c commit a76fa79

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/mdc-checkbox/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* THE SOFTWARE.
2222
*/
2323

24-
import {getCorrectEventName} from '@material/animation/index.ts';
24+
import {StandardJsEventType, getCorrectEventName} from '@material/animation/index.ts';
2525
import MDCComponent from '@material/base/component';
2626
/* eslint-disable no-unused-vars */
2727
import {MDCSelectionControlState, MDCSelectionControl} from '@material/selection-control/index';
@@ -33,6 +33,8 @@ import {getMatchesProperty} from '@material/ripple/util';
3333
/** @const {!Array<string>} */
3434
const CB_PROTO_PROPS = ['checked', 'indeterminate'];
3535

36+
const {ANIMATION_END} = StandardJsEventType;
37+
3638
/**
3739
* @extends MDCComponent<!MDCCheckboxFoundation>
3840
* @implements {MDCSelectionControl}
@@ -69,7 +71,7 @@ class MDCCheckbox extends MDCComponent {
6971
this.handleChange_ = () => this.foundation_.handleChange();
7072
this.handleAnimationEnd_= () => this.foundation_.handleAnimationEnd();
7173
this.nativeCb_.addEventListener('change', this.handleChange_);
72-
this.listen(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
74+
this.listen(getCorrectEventName(window, ANIMATION_END), this.handleAnimationEnd_);
7375
this.installPropertyChangeHooks_();
7476
}
7577

@@ -191,7 +193,7 @@ class MDCCheckbox extends MDCComponent {
191193
destroy() {
192194
this.ripple_.destroy();
193195
this.nativeCb_.removeEventListener('change', this.handleChange_);
194-
this.unlisten(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
196+
this.unlisten(getCorrectEventName(window, ANIMATION_END), this.handleAnimationEnd_);
195197
this.uninstallPropertyChangeHooks_();
196198
super.destroy();
197199
}

test/unit/mdc-slider/foundation-pointer-events.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
import {assert} from 'chai';
2525
import td from 'testdouble';
2626

27-
import {getCorrectEventName} from '../../../packages/mdc-animation/index.ts';
27+
import {StandardJsEventType, getCorrectEventName} from '../../../packages/mdc-animation/index.ts';
2828

2929
import {cssClasses} from '../../../packages/mdc-slider/constants';
3030
import {TRANSFORM_PROP, setupEventTest as setupTest} from './helpers';
3131

3232
suite('MDCSliderFoundation - pointer events');
3333

34-
const TRANSITION_END_EVT = getCorrectEventName(window, 'transitionend');
34+
const TRANSITION_END_EVT = getCorrectEventName(window, StandardJsEventType.TRANSITION_END);
3535

3636
createTestSuiteForPointerEvents('mousedown', 'mousemove', 'mouseup');
3737
createTestSuiteForPointerEvents('pointerdown', 'pointermove', 'pointerup');

0 commit comments

Comments
 (0)