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

fix(chips): Fix choice-chips leading icon being hidden #2796

Merged
merged 14 commits into from
May 30, 2018

Conversation

EstebanG23
Copy link
Contributor

@EstebanG23 EstebanG23 commented May 23, 2018

Fixes #2728

Add a boolean to not remove the leading icon when selected chip does not contain a checkmark.
Change the color of the leading icon when selected. Change the tests to ensure it is checking the right chips. Add test for selected chip with leading icon and no checkmark, to not
remove the leading icon.

Esteban Gonzalez added 2 commits May 23, 2018 12:19
Add some if statements to not remove the leading icon when selected.
Change the color of the leading icon when selected. Change the tests to
ensure it is checking the right chips.
Add test for selected chip with leading icon and no checkmark to not
remove the leading icon.
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

@EstebanG23 EstebanG23 requested a review from bonniezhou May 23, 2018 21:37
@codecov-io
Copy link

codecov-io commented May 23, 2018

Codecov Report

Merging #2796 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2796   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files          98       98           
  Lines        4182     4182           
  Branches      532      532           
=======================================
  Hits         4115     4115           
  Misses         67       67

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 eeb8266...13468fb. Read the comment docs.

@@ -115,7 +115,7 @@

// Add leading checkmark to filter chips with a leading icon

.mdc-chip__icon--leading {
.mdc-chip-set--filter .mdc-chip__icon--leading {
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 it'll be more readable if you put all these inside a single .mdc-chip-set--filter selector block like this:

.mdc-chip-set--filter {
  .mdc-chip__icon--leading {
    ...
  }
  ...
}

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!

* Returns true if contains the checkmark class.
* @return {boolean}
*/
hasCheckmark() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just realized...if we're restricting the opacity changes to filter chips in CSS, then we don't need to check for checkmarks in the JS anymore :D

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!

@bonniezhou bonniezhou self-assigned this May 24, 2018
Copy link
Contributor

@bonniezhou bonniezhou left a comment

Choose a reason for hiding this comment

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

One small thing, otherwise LGTM!

@@ -161,7 +161,7 @@ class MDCChipFoundation extends MDCFoundation {
this.adapter_.hasClass(cssClasses.SELECTED)) {
this.adapter_.addClassToLeadingIcon(cssClasses.HIDDEN_LEADING_ICON);
} else if (this.adapter_.eventTargetHasClass(/** @type {!EventTarget} */ (evt.target), cssClasses.CHECKMARK) &&
!this.adapter_.hasClass(cssClasses.SELECTED)) {
!this.adapter_.hasClass(cssClasses.SELECTED)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move to one line :)

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!

@EstebanG23 EstebanG23 merged commit 7d406fa into master May 30, 2018
@EstebanG23 EstebanG23 deleted the chip/prototype branch May 30, 2018 23:26
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.

5 participants