|
|
|
@ -35,4 +35,13 @@ describe('delay spinning', () => {
|
|
|
|
|
.hasClass('ant-spin-spinning'),
|
|
|
|
|
).toEqual(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should cancel debounce function when unmount', async () => {
|
|
|
|
|
const wrapper = mount(<Spin spinning delay={100} />);
|
|
|
|
|
const spy = jest.spyOn(wrapper.instance().updateSpinning, 'cancel');
|
|
|
|
|
expect(wrapper.instance().updateSpinning.cancel).toEqual(expect.any(Function));
|
|
|
|
|
expect(spy).not.toHaveBeenCalled();
|
|
|
|
|
wrapper.unmount();
|
|
|
|
|
expect(spy).toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|