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

feat(checkbox): Annotate mdc-checkbox for closure #867

Merged
merged 3 commits into from
Jul 5, 2017
Merged

feat(checkbox): Annotate mdc-checkbox for closure #867

merged 3 commits into from
Jul 5, 2017

Conversation

nckh
Copy link
Contributor

@nckh nckh commented Jun 27, 2017

Fixes #334

@codecov-io
Copy link

codecov-io commented Jun 27, 2017

Codecov Report

Merging #867 into master will decrease coverage by 0.26%.
The diff coverage is 59.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #867      +/-   ##
==========================================
- Coverage   98.58%   98.31%   -0.27%     
==========================================
  Files          70       71       +1     
  Lines        3251     3266      +15     
  Branches      393      393              
==========================================
+ Hits         3205     3211       +6     
- Misses         46       55       +9
Impacted Files Coverage Δ
packages/mdc-checkbox/constants.js 100% <ø> (ø) ⬆️
packages/mdc-checkbox/adapter.js 0% <0%> (ø)
packages/mdc-ripple/index.js 100% <100%> (ø) ⬆️
packages/mdc-checkbox/index.js 100% <100%> (ø) ⬆️
packages/mdc-checkbox/foundation.js 100% <100%> (ø) ⬆️

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 0a8a75d...1894514. Read the comment docs.

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.

Thanks for taking on another component!

@@ -14,8 +14,10 @@
* limitations under the License.
*/

/** @const {string} */
const ROOT = 'mdc-checkbox';
Copy link
Contributor

Choose a reason for hiding this comment

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

is ROOT still referenced somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it's not. Removed!

@@ -220,6 +257,10 @@ export default class MDCCheckboxFoundation extends MDCFoundation {
}
}

/**
* @return {!HTMLInputElement|InputPropsType}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should just return InputPropsType. HTMLInputElement has getters for checked, indeterminate, disabled, and value.

Why does getNativeControl_ return a fake HTMLInputElement anyway? I know that is outside the scope of this PR...but it seems to be affecting how we annotate the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed HTMLInputElement and moved InputPropsType def to the adapter so that the result of querySelector() can be casted to this type in the component class.

Returning that fake element seems to be required by some unit tests verifying the getters still work when no native control is returned.

* value: ?string
* }}
*/
let InputPropsType;
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer InputElementState...but I'd like to first know why we return a fake HTMLInputElement in getNativeControl_

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the naming suggestion :)

* disabled: (boolean|undefined)
* }}
*/
let RippleAbleType;
Copy link
Contributor

Choose a reason for hiding this comment

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

I talked to our MD team a bit, and I think "RippleCapableSurface" is more clear. Can you add a link to our guidelines on when to use ripples:
https://material.io/guidelines/motion/choreography.html#choreography-radial-reaction

Can you also add a note about what "unbounded" and "disabled" means from a ripple's point of view.

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 changed from @typedef to @record so that those comments can be inlined.

@nckh
Copy link
Contributor Author

nckh commented Jun 28, 2017

Thanks for the review Lynn.

I've also used the EventListener type every where callbacks were typed to Function to align with the original annotations in MDCCheckboxFoundation.defaultAdapter.

@lynnmercier
Copy link
Contributor

Sorry for the long delay, I was on vacation.

This generally looks good, so I'm going to update the branch and make sure all tests still pass. If they do, I will merge!

@lynnmercier lynnmercier merged commit a6956b8 into material-components:master Jul 5, 2017
@nckh nckh deleted the feat/closure-checkbox branch July 6, 2017 02:32
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.

3 participants