I have a component that contains input that has assigned function to ref and I try to write test for it:
<input
id="input-element"
type="checkbox"
checked={isChecked}
ref={(input) => {
if (input) {
input.indeterminate = true;
}
}}
className="checkbox" />
And my question is how check in test if the input indeterminate is set to true. Documentation https://airbnb.io/enzyme/docs/api/ReactWrapper/ref.html didn't help me because there are only very simple and useless examples.
I tried to test it so:
const wrapper = shallow(<MyComponent {...props}/>);
expect(wrapper.find('#input-element').prop('indeterminate')).toBeTruthy();
But wrapper.find('#input-element').prop('indeterminate')
returns me undefined