{
expect(node.nodeName).toBe('DIV');
}}
/>,
);
});
it('should support number option', () => {
const onChange = jest.fn();
const wrapper = mount();
wrapper.find('.ant-checkbox-input').at(0).simulate('change');
expect(onChange).toHaveBeenCalledWith([1]);
});
it('should store latest checkbox value if changed', () => {
const onChange = jest.fn();
const Demo = () => {
const [v, setV] = useState('');
React.useEffect(() => {
setTimeout(setV('1'), 1000);
}, []);
return (
setV(e.target.value)} />
A
);
};
const wrapper = mount();
wrapper.find('.ant-checkbox-input').first().simulate('change');
expect(onChange).toHaveBeenCalledWith([]);
wrapper.find('.ant-checkbox-input').first().simulate('change');
expect(onChange).toHaveBeenCalledWith(['length1']);
wrapper
.find('.ant-input')
.first()
.simulate('change', { target: { value: '' } });
wrapper.find('.ant-checkbox-input').first().simulate('change');
expect(onChange).toHaveBeenCalledWith(['A']);
});
});