Skip to content

Commit 5cea64f

Browse files
authored
fix(form) :increase the parame of the actions function to maintain consistency. (#9137)
* feat: increase the parame of the actions function to maintain consistency * feat: increase the parame of the actions function to maintain consistency * feat: increase the parame of the actions function to maintain consistency
1 parent dc22c7f commit 5cea64f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/form/src/components/List/ListItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ const ProFormListItem: React.FC<
402402
.filter((item) => item !== undefined)
403403
.flat(1),
404404
);
405-
await action.add(row);
405+
await action.add(row, count);
406406
setLoadingCopy(false);
407407
}}
408408
/>

tests/form/formList.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,9 @@ describe('ProForm List', () => {
956956
Icon: CloseOutlined,
957957
}}
958958
actionGuard={{
959-
beforeAddRow: async (defaultValue, insertIndex) => {
959+
beforeAddRow: async (defaultValue, insertIndex, count) => {
960960
return new Promise((resolve) => {
961-
fnAdd(defaultValue?.name, insertIndex);
961+
fnAdd(defaultValue?.name, insertIndex, count);
962962
setTimeout(() => resolve(true), 1000);
963963
});
964964
},
@@ -994,7 +994,7 @@ describe('ProForm List', () => {
994994
(await html.findByText('添加一行数据')).parentElement?.click();
995995
});
996996

997-
expect(fnAdd).toHaveBeenLastCalledWith(undefined, 1);
997+
expect(fnAdd).toHaveBeenLastCalledWith(undefined, 1, 1);
998998
expect(html.baseElement.querySelectorAll('input.ant-input').length).toBe(1);
999999
await waitForWaitTime(1200);
10001000

@@ -1007,7 +1007,7 @@ describe('ProForm List', () => {
10071007
?.click?.();
10081008
});
10091009

1010-
expect(fnAdd).toHaveBeenLastCalledWith('1111', 2);
1010+
expect(fnAdd).toHaveBeenLastCalledWith('1111', 2, 2);
10111011

10121012
await waitForWaitTime(1200);
10131013

0 commit comments

Comments
 (0)