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

feat(text-field): Add foundation.setValue method #1615

Conversation

anton-kachurin
Copy link
Contributor

  • Adds foundation.setValue method
  • Adds adapter.labelHasClass method

BREAKING CHANGE: Please update implementations of MDCTextFieldAdapter to implement the method labelHasClass

@anton-kachurin anton-kachurin force-pushed the feat/text-field-setvalue branch from d1d2069 to 11689fa Compare November 19, 2017 05:39
@codecov-io
Copy link

codecov-io commented Nov 19, 2017

Codecov Report

Merging #1615 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1615      +/-   ##
=========================================
+ Coverage    99.4%   99.4%   +<.01%     
=========================================
  Files          78      78              
  Lines        3522    3547      +25     
  Branches      426     430       +4     
=========================================
+ Hits         3501    3526      +25     
  Misses         21      21
Impacted Files Coverage Δ
packages/mdc-textfield/input/foundation.js 95% <100%> (+0.17%) ⬆️
packages/mdc-textfield/foundation.js 99.29% <100%> (+0.1%) ⬆️
packages/mdc-textfield/index.js 92.22% <100%> (+0.45%) ⬆️

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 074919a...a1971a9. Read the comment docs.

@anton-kachurin anton-kachurin force-pushed the feat/text-field-setvalue branch from ddfa1c5 to c424e1a Compare November 19, 2017 08:46
@anton-kachurin
Copy link
Contributor Author

It's ready for a review

Copy link
Contributor

@lynnmercier lynnmercier left a comment

Choose a reason for hiding this comment

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

So many tests! Look at you go!!

@@ -24,6 +24,7 @@ const strings = {
ICON_SELECTOR: '.mdc-text-field__icon',
ICON_EVENT: 'MDCTextField:icon',
BOTTOM_LINE_SELECTOR: '.mdc-text-field__bottom-line',
INPUT_PROTO_PROP: 'value',
Copy link
Contributor

Choose a reason for hiding this comment

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

this one snuck in here

updateLabelFloat_() {
const input = this.getNativeInput_();
const {LABEL_FLOAT_ABOVE} = MDCTextFieldFoundation.cssClasses;

Copy link
Contributor

Choose a reason for hiding this comment

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

add a

const labelFloatIsActive = this.adapter_.labelHasClass(LABEL_FLOAT_ABOVE);

Then reference labelFloatIsActive instead of this.labelFloatIsActive_ for the rest of this method

@@ -78,6 +79,8 @@ class MDCTextFieldFoundation extends MDCFoundation {
this.receivedUserInput_ = false;
/** @private {boolean} */
this.useCustomValidityChecking_ = false;
/** @private {boolean} */
Copy link
Contributor

Choose a reason for hiding this comment

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

You won't need this.labelFloatIsActive_ after you change this to a const with the updateLabelFloat_ method

@lynnmercier lynnmercier self-assigned this Nov 20, 2017
@anton-kachurin
Copy link
Contributor Author

@lynnjepsen Please review

Copy link
Contributor

@lynnmercier lynnmercier left a comment

Choose a reason for hiding this comment

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

LGTM

lynnmercier and others added 6 commits November 21, 2017 09:31
…ts#1631)

BREAKING CHANGE: Please update implementations of MDCTextFieldAdapter to implement getInputFoundation(). Methods registerInputInteractionHandler()/deregisterInputInteractionHandler() have been renamed to registerInputEventHandler()/deregisterInputEventHandler(). getNativeInput() is no longer in MDCTextFieldAdapter. See the README for mdc-textfield/input for more information.
@amsheehan
Copy link
Contributor

It looks like there are a few merge conflicts that have cropped up. @lynnjepsen is this a case where we are waiting for other things to land before merging?

@lynnmercier
Copy link
Contributor

Hey @anton-kachurin

I had meant to merge this PR before we did refactoring on mdc-text-field...but missed my opportunity. I even tried to merge this up to master, but it's quite a lot of merge conflicts.

I think our best bet at getting this logic into mdc-text-field is for you to comment on #1740. @bwobrien is adding a setValue method to the text field foundation. And he did use this PR for some inspiration.

I'm going to close this...but please leave comments on #1740 if there is something you think is missing.

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