Skip to content

Commit e7bfeb1

Browse files
chore: try fix test error (#8925)
* feat(tests): integrate jsdom and update StyleProvider in demo tests * fix(tests): 优化测试文件中的导入顺序和样式 * 优化渲染器,减少block * fix(tests): 更新 lightFilter 测试以使用新的渲染方法并修复元素选择
1 parent feb8200 commit e7bfeb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2378
-2674
lines changed

package.json

+30-29
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,38 @@
4949
},
5050
"devDependencies": {
5151
"@ant-design/antd-theme-variable": "^1.0.0",
52-
"@ant-design/cssinjs": "^1.21.1",
53-
"@ant-design/icons": "^5.5.1",
52+
"@ant-design/cssinjs": "^1.22.1",
53+
"@ant-design/icons": "^5.5.2",
5454
"@babel/core": "^7.26.0",
5555
"@babel/eslint-plugin": "^7.25.9",
56-
"@babel/parser": "^7.26.2",
56+
"@babel/parser": "^7.26.3",
5757
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
5858
"@babel/preset-env": "^7.26.0",
59-
"@babel/preset-react": "^7.25.9",
59+
"@babel/preset-react": "^7.26.3",
6060
"@babel/preset-typescript": "^7.26.0",
61-
"@babel/traverse": "^7.25.9",
62-
"@emotion/babel-plugin": "^11.12.0",
63-
"@emotion/cache": "^11.13.1",
64-
"@emotion/css": "^11.13.4",
65-
"@emotion/serialize": "^1.3.2",
61+
"@babel/traverse": "^7.26.4",
62+
"@emotion/babel-plugin": "^11.13.5",
63+
"@emotion/cache": "^11.14.0",
64+
"@emotion/css": "^11.13.5",
65+
"@emotion/serialize": "^1.3.3",
6666
"@floating-ui/react": "^0.19.2",
6767
"@octokit/core": "^3.6.0",
6868
"@octokit/rest": "^18.12.0",
69-
"@testing-library/dom": "^8.20.1",
70-
"@testing-library/jest-dom": "^5.17.0",
71-
"@testing-library/react": "^13.4.0",
69+
"@testing-library/dom": "^10.4.0",
70+
"@testing-library/jest-dom": "^6.6.3",
71+
"@testing-library/react": "^16.1.0",
7272
"@testing-library/react-hooks": "^8.0.1",
7373
"@testing-library/user-event": "^14.5.2",
7474
"@types/chroma-js": "^2.4.4",
7575
"@types/glob": "^8.1.0",
7676
"@types/history": "^4.7.11",
77+
"@types/jsdom": "^21.1.7",
7778
"@types/lodash": "^4.17.13",
7879
"@types/lodash-es": "^4.17.12",
7980
"@types/mockjs": "^1.0.10",
8081
"@types/node": "^14.18.63",
81-
"@types/react": "^18.3.12",
82-
"@types/react-dom": "^18.3.1",
82+
"@types/react": "^18.3.17",
83+
"@types/react-dom": "^18.3.5",
8384
"@types/react-helmet": "^6.1.11",
8485
"@types/react-responsive": "^8.0.8",
8586
"@types/shallowequal": "^1.1.5",
@@ -90,10 +91,10 @@
9091
"@umijs/plugin-analytics": "^0.2.4",
9192
"@umijs/test": "^3.5.43",
9293
"@umijs/test-utils": "^3.5.43",
93-
"@umijs/utils": "^4.3.31",
94+
"@umijs/utils": "^4.4.1",
9495
"@vitest/coverage-istanbul": "^0.34.6",
9596
"animated-scroll-to": "^2.3.0",
96-
"antd": "^5.22.1",
97+
"antd": "^5.22.5",
9798
"antd-style": "^3.7.1",
9899
"babel-loader": "^9.2.1",
99100
"babel-types": "^6.26.0",
@@ -102,7 +103,7 @@
102103
"copy-to-clipboard": "^3.3.3",
103104
"cross-env": "^7.0.3",
104105
"dayjs": "^1.11.13",
105-
"dumi": "~2.4.13",
106+
"dumi": "~2.4.16",
106107
"dumi-theme-antd-style": "~0.31.1",
107108
"esbuild": "^0.15.18",
108109
"eslint": "^8.57.1",
@@ -111,7 +112,7 @@
111112
"eslint-plugin-react-hooks": "^4.6.2",
112113
"eslint-plugin-unicorn": "^47.0.0",
113114
"execa": "^5.1.1",
114-
"express": "^4.21.1",
115+
"express": "^4.21.2",
115116
"fast-deep-equal": "^3.1.3",
116117
"father": "^4.5.1",
117118
"gh-pages": "^5.0.0",
@@ -120,7 +121,7 @@
120121
"inquirer": "^8.2.6",
121122
"jest-canvas-mock": "^2.5.2",
122123
"jest-fetch-mock": "^3.0.3",
123-
"jsdom": "^19.0.0",
124+
"jsdom": "^25.0.1",
124125
"lerna": "^3.22.1",
125126
"lint-staged": "^10.5.4",
126127
"lodash": "^4.17.21",
@@ -130,23 +131,23 @@
130131
"moment": "^2.30.1",
131132
"np": "^6.5.0",
132133
"nprogress": "^0.2.0",
133-
"octokit": "^3.1.2",
134+
"octokit": "^3.2.1",
134135
"polished": "^4.3.1",
135136
"prettier": "^2.8.8",
136137
"prettier-plugin-organize-imports": "^3.2.4",
137-
"prettier-plugin-packagejson": "^2.5.3",
138+
"prettier-plugin-packagejson": "^2.5.6",
138139
"pretty-quick": "^3.3.1",
139140
"query-string": "^6.14.1",
140-
"rc-field-form": "^2.5.1",
141+
"rc-field-form": "^2.7.0",
141142
"rc-footer": "^0.6.8",
142-
"rc-resize-observer": "^1.4.0",
143+
"rc-resize-observer": "^1.4.1",
143144
"rc-steps": "^6.0.1",
144-
"rc-table": "^7.48.1",
145-
"rc-util": "^5.43.0",
145+
"rc-table": "^7.49.0",
146+
"rc-util": "^5.44.2",
146147
"react": "^18.3.1",
147148
"react-dom": "^18.3.1",
148149
"react-draggable": "^4.4.6",
149-
"react-layout-kit": "^1.9.0",
150+
"react-layout-kit": "^1.9.1",
150151
"react-lazy-load": "^4.0.1",
151152
"react-markdown": "^8.0.7",
152153
"react-syntax-highlighter": "^15.6.1",
@@ -159,12 +160,12 @@
159160
"stylelint": "^13.13.1",
160161
"timezone-mock": "^1.3.6",
161162
"ts-node": "^10.9.2",
162-
"typescript": "^5.6.3",
163-
"umi": "^4.3.31",
163+
"typescript": "^5.7.2",
164+
"umi": "^4.4.1",
164165
"umi-request": "^1.4.0",
165166
"unified": "^11.0.5",
166167
"unist-util-visit": "^5.0.0",
167-
"vitest": "^1.6.0",
168+
"vitest": "^2.1.8",
168169
"write-pkg": "^4.0.0",
169170
"xhr-mock": "^2.5.1",
170171
"yorkie": "^2.0.0",

packages/field/src/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const defaultRenderText = (
222222
...props,
223223
mode: mode || 'read',
224224
},
225-
<>{dataValue}</>,
225+
<>{dataValue as any}</>,
226226
);
227227
}
228228
if (mode === 'update' || mode === 'edit') {
@@ -232,7 +232,7 @@ const defaultRenderText = (
232232
text: dataValue as React.ReactNode,
233233
...props,
234234
},
235-
<>{dataValue}</>,
235+
<>{dataValue as any}</>,
236236
);
237237
}
238238
}

packages/form/src/layouts/LightFilter/index.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,15 @@ const LightFilterContainer: React.FC<{
148148
>
149149
<div className={`${lightFilterClassName}-container ${hashId}`.trim()}>
150150
{outsideItems.map((child: any, index) => {
151+
if (!child?.props) {
152+
return child;
153+
}
151154
const { key } = child;
152-
const { fieldProps } = child.props;
155+
const { fieldProps } = child?.props || {};
153156
const newPlacement = fieldProps?.placement
154157
? fieldProps?.placement
155158
: placement;
159+
156160
return (
157161
<div
158162
className={`${lightFilterClassName}-item ${hashId}`.trim()}
@@ -282,8 +286,9 @@ function LightFilter<T = Record<string, any>>(props: LightFilterProps<T>) {
282286
<LightFilterContainer
283287
prefixCls={prefixCls}
284288
items={items?.flatMap((item: any) => {
289+
if (!item || !item?.type) return item;
285290
/** 如果是 ProFormGroup,直接拼接dom */
286-
if (item?.type.displayName === 'ProForm-Group')
291+
if (item?.type?.displayName === 'ProForm-Group')
287292
return item.props.children;
288293
return item;
289294
})}

packages/form/src/layouts/QueryFilter/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const flatMapItems = (
202202
ignoreRules?: boolean,
203203
): React.ReactNode[] => {
204204
return items?.flatMap((item: any) => {
205-
if (item?.type.displayName === 'ProForm-Group' && !item.props?.title) {
205+
if (item?.type?.displayName === 'ProForm-Group' && !item.props?.title) {
206206
return item.props.children;
207207
}
208208

0 commit comments

Comments
 (0)