test: update cases for Modal

This commit is contained in:
zy410419243 2019-03-07 12:45:14 +08:00
parent f38323aeca
commit 8d43f4b032

View File

@ -43,4 +43,18 @@ describe('Modal', () => {
const wrapper = mount(<ModalTester footer={null} />);
expect(wrapper.render()).toMatchSnapshot();
});
it('onCancel should be called', () => {
const onCancel = jest.fn();
const wrapper = mount(<Modal onCancel={onCancel} />).instance();
wrapper.handleCancel();
expect(onCancel).toBeCalled();
});
it('onOk should be called', () => {
const onOk = jest.fn();
const wrapper = mount(<Modal onOk={onOk} />).instance();
wrapper.handleOk();
expect(onOk).toBeCalled();
});
});