[core] Use useFormControl instead of withFormControlState #16503
Conversation
testing public interface
Making it more obvious that the full context is private
| ); | ||
| expect(readContext.args[0][0]).to.have.property('focused', false); | ||
|
|
||
| act(() => { |
| @@ -30,126 +35,141 @@ describe('<FormControlLabel />', () => { | |||
| })); | |||
|
|
|||
| it('should render the label text inside an additional element', () => { | |||
There was a problem hiding this comment.
This test never tested that there is an additional element. Now it does.
|
@material-ui/core: parsed: +Infinity% , gzip: +Infinity% Details of bundle changes.Comparing: cf2cdd8...d933cd0
|
| }); | ||
| expect(handleChange.callCount).to.equal(1); | ||
| // event.target.check is true | ||
| expect(handleChange.firstCall.returnValue).to.be.true; |
There was a problem hiding this comment.
What's the advantage over using the generic equal?
| expect(handleChange.firstCall.returnValue).to.be.true; | |
| expect(handleChange.firstCall.returnValue).to.equal(true); |
For reference, I can't find this API equivalent in the Jest documentation: https://jestjs.io/.
There was a problem hiding this comment.
@merceyz Thanks for the links. Do you know if there is a .toBeTrue() like API?
There was a problem hiding this comment.
That's the closest you'll get
There was a problem hiding this comment.
I'm not following what the issue is? This appeared to be a question about jest which was answered
There was a problem hiding this comment.
My proposal is to replace the usages of to.be.true and to.be.false with the generic to.be.equal API. I have used Jest's API as a benchmark. The opportunity is to reduce the API surface.
FormControlContext.Provider.