Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(checkbox): remove register/deregisterEventlisteners from foundation #3402

Merged
merged 8 commits into from
Aug 24, 2018

Conversation

moog16
Copy link
Contributor

@moog16 moog16 commented Aug 23, 2018

refs #2813

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

144 screenshots changed from master on commit 1a0b854:

Details

144 Changed:

@codecov-io
Copy link

codecov-io commented Aug 23, 2018

Codecov Report

Merging #3402 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3402      +/-   ##
==========================================
- Coverage   98.41%   98.41%   -0.01%     
==========================================
  Files         123      123              
  Lines        5183     5180       -3     
  Branches      638      639       +1     
==========================================
- Hits         5101     5098       -3     
  Misses         82       82
Impacted Files Coverage Δ
packages/mdc-checkbox/index.js 100% <100%> (ø) ⬆️
packages/mdc-checkbox/foundation.js 97.47% <100%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9bd102...0acae16. Read the comment docs.

@mdc-web-bot
Copy link
Collaborator

All 353 screenshot tests passed for commit b148d92 vs. master! 💯🎉

this.handleChange_ = () => this.foundation_.handleChange();
this.handleAnimationEnd_= () => this.foundation_.handleAnimationEnd();
this.nativeCb_.addEventListener('change', this.handleChange_);
this.root_.addEventListener(getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to this.listen (since you're using unlisten in destroy anyway)

@@ -297,6 +291,8 @@ class MDCCheckboxFoundation extends MDCFoundation {
this.adapter_.setNativeControlAttr(
strings.ARIA_CHECKED_ATTR, strings.ARIA_CHECKED_INDETERMINATE_VALUE);
} else {
// the on/off state does not need to keep track of aria-checked, since
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Capitalize The

td.verify(component.foundation_.handleAnimationEnd(), {times: 1});
});

test('checkbox change event is destroyed on #destroy', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

event handler is destroyed

td.verify(component.foundation_.handleChange(), {times: 0});
});

test('root animationend event is destroyed on #destroy', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

event handler is destroyed

(handler) => this.root_.addEventListener(getCorrectEventName(window, 'animationend'), handler),
deregisterAnimationEndHandler:
(handler) => this.root_.removeEventListener(getCorrectEventName(window, 'animationend'), handler),
registerChangeHandler: (handler) => this.nativeCb_.addEventListener('change', handler),
Copy link
Contributor

Choose a reason for hiding this comment

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

You forgot to remove deregisterChangeHandler (I noticed because coverage found it uncovered, but it shouldn't be here anymore)

Matt Goo added 3 commits August 24, 2018 09:22
rge branch 'fix/checkbox/update-event-listener-management' of github.com:material-components/material-components-web into fix/checkbox/update-event-listener-management
@mdc-web-bot
Copy link
Collaborator

All 353 screenshot tests passed for commit b440ea1 vs. master! 💯🎉

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

In the commit description, include the usual BREAKING CHANGE: e.g. "Event registration adapter APIs have been removed and are now the responsibility of the component"

@mdc-web-bot
Copy link
Collaborator

All 353 screenshot tests passed for commit 0acae16 vs. master! 💯🎉

@moog16 moog16 merged commit 430b338 into master Aug 24, 2018
@moog16 moog16 deleted the fix/checkbox/update-event-listener-management branch August 24, 2018 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants