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

feat(chips): Move logic for calculating chip bounding rect into a foundation method #4243

Merged
merged 5 commits into from
Jan 14, 2019

Conversation

rlfriedman
Copy link
Contributor

@rlfriedman rlfriedman commented Jan 11, 2019

This change makes adding ripple easier for clients wrapping chips.

BREAKING CHANGE: Adds 3 new chips adapter methods: hasLeadingIcon, getRootBoundingClientRect, and getCheckmarkBoundingClientRect. Also adds a new foundation method: getDimensions.

@codecov-io
Copy link

codecov-io commented Jan 11, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@4688971). Click here to learn what that means.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #4243   +/-   ##
=========================================
  Coverage          ?   98.58%           
=========================================
  Files             ?      127           
  Lines             ?     5705           
  Branches          ?      762           
=========================================
  Hits              ?     5624           
  Misses            ?       81           
  Partials          ?        0
Impacted Files Coverage Δ
packages/mdc-chips/chip/foundation.js 100% <100%> (ø)
packages/mdc-chips/chip/index.js 98.63% <87.5%> (ø)

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 4688971...f0bdc5c. Read the comment docs.

@mdc-web-bot
Copy link
Collaborator

All 758 screenshot tests passed for commit eba9a1d vs. master! 💯🎉

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.

Don't forget to add these to the Readme.

computeBoundingRect() {
// When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current
// size of the checkmark.
if (!this.adapter_.hasLeadingIcon() && this.adapter_.getCheckmarkBoundingClientRect()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this.adapter.getCheckmarkBoundingClientRect() returns an object...I think it is more precise to check that the function call returns an object, instead of just calling the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to check to confirm it isn't null, does that work?

@@ -60,6 +60,9 @@ class MDCChipFoundation extends MDCFoundation {
notifyRemoval: () => {},
getComputedStyleValue: () => {},
setStyleProperty: () => {},
hasLeadingIcon: () => {},
getBoundingClientRect: () => {},
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 adding root in the method makes it more clear. getRootBoundingClientRect

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

this.ripple_ = rippleFactory(this.root_);
}
const adapter = Object.assign(MDCRipple.createAdapter(this), {
computeBoundingRect: () => this.foundation_.computeBoundingRect(),
Copy link
Contributor

Choose a reason for hiding this comment

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

what about this.foundation_.computeBoundingRectForRipple()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to getDimensions

@mdc-web-bot
Copy link
Collaborator

All 758 screenshot tests passed for commit 71ffdea vs. master! 💯🎉

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

All 758 screenshot tests passed for commit f0bdc5c vs. master! 💯🎉

@mdc-web-bot
Copy link
Collaborator

All 758 screenshot tests passed for commit f0bdc5c vs. master! 💯🎉

@rlfriedman rlfriedman merged commit b30f5e2 into master Jan 14, 2019
@rlfriedman rlfriedman deleted the fix/chips/bounding-rect branch January 14, 2019 19:20
@jamesmfriedman jamesmfriedman mentioned this pull request Feb 5, 2019
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants