diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 8806574333..8a2afdd3c4 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -21904,14 +21904,14 @@ exports[`ConfigProvider components Skeleton prefixCls 1`] = ` exports[`ConfigProvider components Slider configProvider 1`] = `
@@ -21950,22 +21950,19 @@ exports[`ConfigProvider components Slider configProvider 1`] = `
-
`; exports[`ConfigProvider components Slider configProvider componentSize large 1`] = `
@@ -22004,22 +22001,19 @@ exports[`ConfigProvider components Slider configProvider componentSize large 1`]
-
`; exports[`ConfigProvider components Slider configProvider componentSize middle 1`] = `
@@ -22058,22 +22052,19 @@ exports[`ConfigProvider components Slider configProvider componentSize middle 1`
-
`; exports[`ConfigProvider components Slider configProvider virtual and dropdownMatchSelectWidth 1`] = `
@@ -22112,22 +22103,19 @@ exports[`ConfigProvider components Slider configProvider virtual and dropdownMat
-
`; exports[`ConfigProvider components Slider normal 1`] = `
@@ -22166,22 +22154,19 @@ exports[`ConfigProvider components Slider normal 1`] = `
-
`; exports[`ConfigProvider components Slider prefixCls 1`] = `
@@ -22220,9 +22205,6 @@ exports[`ConfigProvider components Slider prefixCls 1`] = `
-
`; diff --git a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap index e0b571afa8..716c00ce29 100644 --- a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -15254,41 +15254,41 @@ exports[`renders ./components/form/demo/validate-other.md extend context correct class="ant-form-item-control-input-content" >
@@ -15330,37 +15330,37 @@ exports[`renders ./components/form/demo/validate-other.md extend context correct > A B C D E F diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index dd02fced97..7f0aeb06b7 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -6339,41 +6339,41 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = ` class="ant-form-item-control-input-content" >
A B C D E F diff --git a/components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap index 6a70a5aa85..902f65cfd5 100644 --- a/components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/grid/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -838,41 +838,41 @@ Array [ style="width:50%" >
@@ -914,37 +914,37 @@ Array [ > 8 16 24 32 40 48 @@ -958,41 +958,41 @@ Array [ style="width:50%" >
@@ -1034,37 +1034,37 @@ Array [ > 8 16 24 32 40 48 @@ -1078,41 +1078,41 @@ Array [ style="width:50%;margin-bottom:48px" >
@@ -1154,37 +1154,37 @@ Array [ > 2 3 4 6 8 12 diff --git a/components/grid/__tests__/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap index e003cb99ce..4e9428a144 100644 --- a/components/grid/__tests__/__snapshots__/demo.test.js.snap +++ b/components/grid/__tests__/__snapshots__/demo.test.js.snap @@ -838,41 +838,41 @@ Array [ style="width:50%" >
8 16 24 32 40 48 @@ -934,41 +934,41 @@ Array [ style="width:50%" >
8 16 24 32 40 48 @@ -1030,41 +1030,41 @@ Array [ style="width:50%;margin-bottom:48px" >
2 3 4 6 8 12 diff --git a/components/slider/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/slider/__tests__/__snapshots__/demo-extend.test.ts.snap index a2fb486332..43f642d410 100644 --- a/components/slider/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/slider/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -3,14 +3,14 @@ exports[`renders ./components/slider/demo/basic.md extend context correctly 1`] = ` Array [
@@ -49,19 +49,16 @@ Array [
-
,
@@ -107,7 +104,7 @@ Array [ aria-valuenow="50" class="ant-slider-handle ant-slider-handle-2" role="slider" - style="left:50%;right:auto;transform:translateX(-50%)" + style="left:50%;transform:translateX(-50%)" tabindex="0" />
@@ -134,9 +131,6 @@ Array [
-
, "Disabled: ", ,
@@ -433,9 +433,6 @@ Array [
-
,
@@ -1581,9 +1578,6 @@ Array [
-
,
,
-
,
-
,
, { refFocus = false } = {}) { +export default function focusTest( + Component: React.ComponentType, + { refFocus = false, testLib = false } = {}, +) { describe('focus and blur', () => { let focused = false; let blurred = false; @@ -21,6 +26,41 @@ export default function focusTest(Component: React.ComponentType, { refFocu } }); + // ==================== React Test Lib ==================== + if (testLib) { + it('Test: focus() and onFocus', () => { + const handleFocus = jest.fn(); + const ref = React.createRef(); + const { unmount } = render(); + ref.current.focus(); + expect(handleFocus).toHaveBeenCalled(); + + unmount(); + }); + + it('Test: blur() and onBlur', async () => { + const handleBlur = jest.fn(); + const ref = React.createRef(); + const { unmount } = render(); + ref.current.focus(); + ref.current.blur(); + expect(handleBlur).toHaveBeenCalled(); + + unmount(); + }); + + it('Test: autoFocus', () => { + const handleFocus = jest.fn(); + const { unmount } = render(); + expect(handleFocus).toHaveBeenCalled(); + + unmount(); + }); + + return; + } + + // ======================== Enzyme ======================== let container: HTMLElement; beforeEach(() => { container = document.createElement('div');