Skip to content

Commit d02ddec

Browse files
committed
chore: merge two beforeEach hooks logics
1 parent 7add058 commit d02ddec

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/new-range.spec.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jest.mock('rc-util/lib/Dom/isVisible', () => {
2525
});
2626

2727
describe('NewPicker.Range', () => {
28+
let rangeRect = { x: 0, y: 0, width: 0, height: 0 };
2829
beforeEach(() => {
2930
resetWarned();
3031
jest.useFakeTimers().setSystemTime(getDay('1990-09-03 00:00:00').valueOf());
@@ -36,16 +37,8 @@ describe('NewPicker.Range', () => {
3637
return childList.indexOf(this) * 30;
3738
},
3839
});
39-
});
40-
41-
afterEach(() => {
42-
jest.clearAllTimers();
43-
jest.useRealTimers();
44-
});
4540

46-
let rangeRect = { x: 0, y: 0, width: 0, height: 0 };
47-
48-
beforeEach(() => {
41+
// =============== handle trigger align ===============
4942
rangeRect = {
5043
x: 0,
5144
y: 0,
@@ -54,7 +47,11 @@ describe('NewPicker.Range', () => {
5447
};
5548

5649
document.documentElement.scrollLeft = 0;
57-
// jest.useFakeTimers();
50+
});
51+
52+
afterEach(() => {
53+
jest.clearAllTimers();
54+
jest.useRealTimers();
5855
});
5956

6057
beforeAll(() => {

0 commit comments

Comments
 (0)