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

select(refactor): decouple label from select #2244

Merged
merged 8 commits into from
Feb 15, 2018

Conversation

moog16
Copy link
Contributor

@moog16 moog16 commented Feb 13, 2018

related #1982

@codecov-io
Copy link

codecov-io commented Feb 13, 2018

Codecov Report

Merging #2244 into master will decrease coverage by 0.4%.
The diff coverage is 54.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2244      +/-   ##
==========================================
- Coverage   99.13%   98.72%   -0.41%     
==========================================
  Files          90       93       +3     
  Lines        3830     3857      +27     
  Branches      496      501       +5     
==========================================
+ Hits         3797     3808      +11     
- Misses         33       49      +16
Impacted Files Coverage Δ
packages/mdc-select/constants.js 100% <ø> (ø) ⬆️
packages/mdc-select/foundation.js 100% <100%> (ø) ⬆️
packages/mdc-select/label/constants.js 100% <100%> (ø)
packages/mdc-select/index.js 100% <100%> (ø) ⬆️
packages/mdc-select/label/index.js 25% <25%> (ø)
packages/mdc-select/label/foundation.js 28.57% <28.57%> (ø)

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 3b0977d...bc99e5e. Read the comment docs.

assert.isTrue(label.classList.contains('foo'));
});

test('adapter#removeClassFromLabel removes a class from the label', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test will be covered in #2244 when MDCSelect uses MDCFloatingLabel

@@ -280,6 +280,26 @@ The `menuFactory` function is passed an `HTMLElement` and is expected to return
instance attached to that element. This is mostly used for testing purposes, but it's there if you
need it nonetheless.

#### Instantiating using a custom `MDCSelectLabel` component.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should be adding docs for instantiating this sub component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove

@@ -153,9 +152,9 @@ export default class MDCSelectFoundation extends MDCFoundation {
if (this.selectedIndex_ >= 0) {
selectedTextContent = this.adapter_.getTextForOptionAtIndex(this.selectedIndex_).trim();
this.adapter_.setAttrForOptionAtIndex(this.selectedIndex_, 'aria-selected', 'true');
this.adapter_.addClassToLabel(cssClasses.LABEL_FLOAT_ABOVE);
this.adapter_.floatLabel(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

We looked up the spec yesterday and saw that this should be moved to the open function, and line 157 should be moved to the closed function.

@import "@material/animation/functions";
@import "@material/animation/variables";
// @import "@material/animation/variables";
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably don't need the commented out import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! Will remove...


@import "@material/theme/mixins";

@mixin mdc-select-floating-label-color($color, $opacity: 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be private ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the current implementation in #2237 it is public. It needs to be public for other modules to change the color. Why do you think it needs to be private?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought public color mixins were supposed to explicitly prevent styling the disabled state
:not(.mdc-text-field--disabled).

&:not(.mdc-text-field--disabled) {

That doesn't really make sense for the separate package though, so maybe it doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it doesn't make sense to have that in the public mixin, but I guess the question then is, should we allow the end developer to style the color in the disabled state?

Also in the current state being in the label module, we shouldn't add in parent classes like .mdc-text-field--disabled or .mdc-select--disabled

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 we're explicitly preventing them from styling the disabled state. It doesn't make sense to include the parent class, we added proxy mixins from the parent to the line-ripple module to prevent customizing the disabled state.

@moog16
Copy link
Contributor Author

moog16 commented Feb 15, 2018

Also RE: color when menu opened and --float-above, is not currently the primary color in 0.30.0. I think this should be a separate issue as that feature has never been in the code base.

Copy link
Contributor

@williamernest williamernest left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

3 participants