diff --git a/components/spin/__tests__/delay.test.js b/components/spin/__tests__/delay.test.js index d9185323b4..0c05d0a1fc 100644 --- a/components/spin/__tests__/delay.test.js +++ b/components/spin/__tests__/delay.test.js @@ -35,4 +35,13 @@ describe('delay spinning', () => { .hasClass('ant-spin-spinning'), ).toEqual(true); }); + + it('should cancel debounce function when unmount', async () => { + const wrapper = mount(); + 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(); + }); });