mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
✅ Add test case for unmounting spin
This commit is contained in:
parent
e34e215f5f
commit
1e62802d58
@ -35,4 +35,13 @@ describe('delay spinning', () => {
|
|||||||
.hasClass('ant-spin-spinning'),
|
.hasClass('ant-spin-spinning'),
|
||||||
).toEqual(true);
|
).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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user