diff --git a/components/_util/__tests__/util.test.js b/components/_util/__tests__/util.test.js index b4f06810a8..cdfa427fd9 100644 --- a/components/_util/__tests__/util.test.js +++ b/components/_util/__tests__/util.test.js @@ -1,11 +1,14 @@ import throttleByAnimationFrame from '../throttleByAnimationFrame'; -jest.useFakeTimers(); - describe('Test utils function', () => { + beforeAll(() => { + jest.useFakeTimers(); + }); + afterAll(() => { jest.useRealTimers(); }); + it('throttle function should work', () => { const callback = jest.fn(); const throttled = throttleByAnimationFrame(callback); diff --git a/components/affix/__tests__/Affix.test.js b/components/affix/__tests__/Affix.test.js index 0a39b2d800..cbdcbd34bb 100644 --- a/components/affix/__tests__/Affix.test.js +++ b/components/affix/__tests__/Affix.test.js @@ -3,8 +3,6 @@ import { mount } from 'enzyme'; import Affix from '..'; import Button from '../../button'; -jest.useFakeTimers(); - const events = {}; class AffixMounter extends React.Component { @@ -48,9 +46,14 @@ class AffixMounter extends React.Component { } describe('Affix Render', () => { + beforeAll(() => { + jest.useFakeTimers(); + }); + afterAll(() => { jest.useRealTimers(); }); + it('Anchor render perfectly', () => { document.body.innerHTML = '
'; diff --git a/components/notification/__tests__/index.test.js b/components/notification/__tests__/index.test.js index e3db717791..a5e6b94e6a 100644 --- a/components/notification/__tests__/index.test.js +++ b/components/notification/__tests__/index.test.js @@ -1,8 +1,10 @@ import notification from '..'; -jest.useFakeTimers(); - describe('notification', () => { + beforeAll(() => { + jest.useFakeTimers(); + }); + afterAll(() => { jest.useRealTimers(); });