diff --git a/components/date-picker/__tests__/RangePicker.test.tsx b/components/date-picker/__tests__/RangePicker.test.tsx index 13f25f9da440..aca3b3ac3ff5 100644 --- a/components/date-picker/__tests__/RangePicker.test.tsx +++ b/components/date-picker/__tests__/RangePicker.test.tsx @@ -11,7 +11,7 @@ import { closePicker, openPicker, selectCell } from './utils'; const { RangePicker } = DatePicker; describe('RangePicker', () => { - focusTest(RangePicker, { refFocus: true }); + focusTest(RangePicker, { refFocus: true, blurDelay: 110 }); beforeEach(() => { setMockDate(); diff --git a/components/date-picker/demo/select-in-range.md b/components/date-picker/demo/select-in-range.md index 25a6e5de608f..66ac734582b5 100644 --- a/components/date-picker/demo/select-in-range.md +++ b/components/date-picker/demo/select-in-range.md @@ -50,6 +50,7 @@ const App: React.FC = () => { onCalendarChange={val => setDates(val)} onChange={val => setValue(val)} onOpenChange={onOpenChange} + onBlur={() => console.log('blur has been triggered')} /> ); }; diff --git a/package.json b/package.json index bbc1f808dede..99fac19a168c 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "rc-motion": "^2.6.1", "rc-notification": "~4.6.0", "rc-pagination": "~3.2.0", - "rc-picker": "~2.6.11", + "rc-picker": "~2.7.0", "rc-progress": "~3.4.1", "rc-rate": "~2.9.0", "rc-resize-observer": "^1.2.0", diff --git a/tests/shared/focusTest.tsx b/tests/shared/focusTest.tsx index b92ec0d0b107..aff5df822228 100644 --- a/tests/shared/focusTest.tsx +++ b/tests/shared/focusTest.tsx @@ -4,7 +4,7 @@ import { sleep, render, fireEvent } from '../utils'; // eslint-disable-next-line jest/no-export export default function focusTest( Component: React.ComponentType, - { refFocus = false, testLib = false } = {}, + { refFocus = false, testLib = false, blurDelay = 0 } = {}, ) { describe('focus and blur', () => { let focused = false; @@ -110,7 +110,7 @@ export default function focusTest( expect(blurred).toBeTruthy(); fireEvent.blur(getElement(container)); - await sleep(0); + await sleep(blurDelay); expect(onBlur).toHaveBeenCalled(); });