Open ShirlyChenLaLaLa opened 6 years ago
it('Calls "onClickReload" when click "reload" button', () => { const loadProps = { error: true }; const onClose = jest.fn().mockName('onClose'); const wrapper = shallow(<LoadingComponent loadProps={ loadProps } onClose={ onClose } activeModal />); const instance = wrapper.instance(); const onClickReload = jest.spyOn(instance, 'onClickReload'); instance.forceUpdate(); const buttonReload = wrapper.find('.loadable-component__btn-retry'); buttonReload.simulate('click'); expect(onClickReload).toHaveBeenCalled(); });