{
refCalls.push(node!);
}}
/>,
);
const [mountCall] = refCalls;
expect(mountCall.nodeName).toBe('DIV');
});
it('should support number option', () => {
const onChange = jest.fn();
const { container } = render(
,
);
fireEvent.click(container.querySelector('.ant-checkbox-input')!);
expect(onChange).toHaveBeenCalledWith([1]);
});
it('should store latest checkbox value if changed', () => {
const onChange = jest.fn();
const Demo: React.FC = () => {
const [v, setV] = useState('');
React.useEffect(() => {
setV('1');
}, []);
return (
setV(e.target.value)} />
A
);
};
const { container } = render();
fireEvent.click(container.querySelector('.ant-checkbox-input')!);
expect(onChange).toHaveBeenCalledWith([]);
fireEvent.click(container.querySelector('.ant-checkbox-input')!);
expect(onChange).toHaveBeenCalledWith(['length1']);
fireEvent.change(container.querySelector('.ant-input')!, { target: { value: '' } });
fireEvent.click(container.querySelector('.ant-checkbox-input')!);
expect(onChange).toHaveBeenCalledWith(['A']);
});
});