mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
type: fix typing bugs in antd 4.x (#54504)
This commit is contained in:
4
.github/workflows/preview-build.yml
vendored
4
.github/workflows/preview-build.yml
vendored
@@ -80,7 +80,7 @@ jobs:
|
||||
SITE_ENV: development
|
||||
|
||||
- name: upload site artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: site
|
||||
path: _site/
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
|
||||
- name: Upload PR number
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pr
|
||||
path: ./pr-id.txt
|
||||
|
||||
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@@ -329,11 +329,11 @@ jobs:
|
||||
mkdir persist-coverage
|
||||
mv coverage/coverage-final.json persist-coverage/react-${{matrix.react}}-test-${{matrix.module}}-${{strategy.job-index}}.json
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ matrix.module == 'dom' && matrix.react == '17' }}
|
||||
name: upload coverages
|
||||
with:
|
||||
name: coverage-artifacts
|
||||
name: coverage-artifacts-${{ matrix.module }}-${{ strategy.job-index }}
|
||||
path: persist-coverage/
|
||||
|
||||
# node test
|
||||
@@ -360,9 +360,10 @@ jobs:
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: coverage-artifacts
|
||||
pattern: coverage-artifacts-*
|
||||
merge-multiple: true
|
||||
path: persist-coverage
|
||||
- name: Merge Code Coverage
|
||||
run: |
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { forwardRef } from 'react';
|
||||
import React, { forwardRef, type Ref } from 'react';
|
||||
import InputNumber from '..';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import { fireEvent, render } from '../../../tests/utils';
|
||||
|
||||
describe('prefix', () => {
|
||||
focusTest(
|
||||
forwardRef((props, ref) => <InputNumber {...props} prefix="A" ref={ref} />),
|
||||
forwardRef((props, ref) => <InputNumber {...props} prefix="A" ref={ref as Ref<HTMLInputElement>} />),
|
||||
{ refFocus: true },
|
||||
);
|
||||
it('should support className when has prefix', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import CSSMotion from 'rc-motion';
|
||||
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
|
||||
import KeyCode from 'rc-util/lib/KeyCode';
|
||||
import React from 'react';
|
||||
import TestUtils, { act } from 'react-dom/test-utils';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
import Modal from '..';
|
||||
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils';
|
||||
@@ -199,10 +199,6 @@ describe('Modal.hook', () => {
|
||||
it('the callback close should be a method when onCancel has a close parameter', async () => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
const clear = async function clear() {
|
||||
await waitFakeTimer();
|
||||
};
|
||||
|
||||
const mockFn = jest.fn();
|
||||
|
||||
const Demo = () => {
|
||||
@@ -229,57 +225,57 @@ describe('Modal.hook', () => {
|
||||
|
||||
const { container } = render(<Demo />);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
||||
// First open
|
||||
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
||||
// Click mask to close
|
||||
fireEvent.click(document.body.querySelectorAll('.ant-modal-wrap')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
||||
// Second open
|
||||
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
||||
// Press ESC to turn off
|
||||
TestUtils.Simulate.keyDown(document.body.querySelectorAll('.ant-modal')[0], {
|
||||
fireEvent.keyDown(document.body.querySelectorAll('.ant-modal')[0], {
|
||||
keyCode: KeyCode.ESC,
|
||||
});
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
||||
// Third open
|
||||
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
||||
// Click the close icon to close
|
||||
fireEvent.click(document.body.querySelectorAll('.ant-modal-close')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
||||
// Last open
|
||||
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
||||
|
||||
// Click the Cancel button to close (invalid)
|
||||
fireEvent.click(document.body.querySelectorAll('.ant-modal-confirm-btns > .ant-btn')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
||||
|
||||
@@ -288,7 +284,7 @@ describe('Modal.hook', () => {
|
||||
// Click the Cancel button to close (valid)
|
||||
fireEvent.click(document.body.querySelectorAll('.ant-modal-confirm-btns > .ant-btn')[0]);
|
||||
|
||||
await clear();
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@
|
||||
"@types/jest-image-snapshot": "^5.1.0",
|
||||
"@types/jquery": "^3.5.14",
|
||||
"@types/lodash": "^4.14.139",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/puppeteer": "^7.0.4",
|
||||
"@types/qs": "^6.9.7",
|
||||
"@types/react": "^18.0.0",
|
||||
@@ -267,7 +268,7 @@
|
||||
"react-dnd": "^16.0.0",
|
||||
"react-dnd-html5-backend": "^16.0.0",
|
||||
"react-dom": "^17.0.0",
|
||||
"react-draggable": "^4.4.3",
|
||||
"react-draggable": "4.4.6",
|
||||
"react-fast-marquee": "^1.2.1",
|
||||
"react-github-button": "^0.1.11",
|
||||
"react-helmet-async": "~1.3.0",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitAny": true,
|
||||
"target": "es6",
|
||||
"lib": ["dom", "es2017"],
|
||||
"lib": ["dom", "es2022"],
|
||||
"skipLibCheck": true,
|
||||
"stripInternal": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user