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

refactor(chips): Register handlers in component instead of foundation #3146

Merged
merged 14 commits into from
Jul 24, 2018

Conversation

bonniezhou
Copy link
Contributor

Part of #2813

@bonniezhou bonniezhou requested a review from patrickrodee July 19, 2018 18:01
@patrickrodee patrickrodee self-assigned this Jul 19, 2018
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.

I assume there should also be newly-public methods added to the readme to indicate what functions need to be called for what events?

@bonniezhou
Copy link
Contributor Author

Whoops, nice catch @kfranqueiro !

@codecov-io
Copy link

codecov-io commented Jul 20, 2018

Codecov Report

Merging #3146 into master will decrease coverage by 0.18%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3146      +/-   ##
==========================================
- Coverage   98.31%   98.13%   -0.19%     
==========================================
  Files         101      101              
  Lines        4454     4444      -10     
  Branches      585      585              
==========================================
- Hits         4379     4361      -18     
- Misses         75       83       +8
Impacted Files Coverage Δ
packages/mdc-chips/chip/foundation.js 98.38% <ø> (-0.38%) ⬇️
packages/mdc-chips/chip-set/index.js 100% <100%> (ø) ⬆️
packages/mdc-chips/chip-set/foundation.js 100% <100%> (ø) ⬆️
packages/mdc-chips/chip/index.js 70.42% <63.63%> (-7.55%) ⬇️

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 8ccd4b6...4773a74. Read the comment docs.

Copy link
Contributor

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

Looks good to me pending 1 comment.

this.handleTransitionEnd_ = (evt) => this.foundation_.handleTransitionEnd(evt);
this.handleTrailingIconInteraction_ = (evt) => this.foundation_.handleTrailingIconInteraction(evt);

['click', 'keydown'].forEach((evtType) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think making this array and the one below into variables will read better, and then you can share it in the destroy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I'm not sure why we omitted touch events from the first array...so I added them in and used the same array for chip interaction and trailing icon interaction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we omitted touch events from the first array

Maybe because the code in handleInteraction is a no-op for anything besides click or keyboard events anyway? I don't think adding touch events will be harmful but they'll also never do anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good point. The touch events are also a no-op in handleTrailingIconInteraction, so I'm just gonna remove them altogether.

Copy link
Contributor

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

LGTM

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report

Commit 7f3b794 vs. master:

No diffs! 💯🎉

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report

Commit 4773a74 vs. master:

No diffs! 💯🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants