Browse Source

fix anchor test fails a lot again

pull/11708/head
afc163 6 years ago
parent
commit
fbab93fbd6
  1. 4
      components/anchor/__tests__/Anchor.test.js

4
components/anchor/__tests__/Anchor.test.js

@ -62,11 +62,11 @@ describe('Anchor Render', () => {
wrapper.instance().handleScrollTo('##API');
expect(wrapper.instance().state.activeLink).toBe('##API');
expect(scrollToSpy).not.toHaveBeenCalled();
await new Promise(resolve => setTimeout(resolve, 50));
expect(scrollToSpy).toHaveBeenCalled();
await new Promise(resolve => setTimeout(resolve, 100));
expect(wrapper.instance().animating).toBe(true);
await new Promise(resolve => setTimeout(resolve, 1000));
expect(wrapper.instance().animating).toBe(false);
expect(scrollToSpy).toHaveBeenCalled();
});
it('should remove listener when unmount', async () => {

Loading…
Cancel
Save