Skip to content

Commit 8594144

Browse files
committed
Fix test-ui SimpleFormIterator click events
1 parent 9c2d2e1 commit 8594144

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

packages/ra-core/src/test-ui/SimpleFormIterator.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ const DefaultAddItemButton = (
3333
return (
3434
<button
3535
type="button"
36-
onClick={() => add()}
36+
onClick={event => {
37+
event.preventDefault();
38+
add();
39+
}}
3740
className={[`button-add button-add-${source}`, className].join(' ')}
3841
{...rest}
3942
>
@@ -58,7 +61,10 @@ const DefaultRemoveItemButton = (
5861
return (
5962
<button
6063
type="button"
61-
onClick={() => remove()}
64+
onClick={event => {
65+
event.preventDefault();
66+
remove();
67+
}}
6268
className={[
6369
`button-remove button-remove-${source}-${index}`,
6470
className,
@@ -83,14 +89,20 @@ const DefaultReOrderButtons = ({ className }: { className?: string }) => {
8389
>
8490
<button
8591
type="button"
86-
onClick={() => reOrder(index - 1)}
92+
onClick={event => {
93+
event.preventDefault();
94+
reOrder(index - 1);
95+
}}
8796
disabled={index <= 0}
8897
>
8998
<Translate i18nKey="ra.action.move_up">Move Up</Translate>
9099
</button>
91100
<button
92101
type="button"
93-
onClick={() => reOrder(index + 1)}
102+
onClick={event => {
103+
event.preventDefault();
104+
reOrder(index + 1);
105+
}}
94106
disabled={total == null || index >= total - 1}
95107
>
96108
<Translate i18nKey="ra.action.move_down">Move Down</Translate>
@@ -282,9 +294,10 @@ export const SimpleFormIterator = (props: SimpleFormIteratorProps) => {
282294
}
283295
/>
284296
<button
285-
onClick={() =>
286-
setConfirmIsOpen(true)
287-
}
297+
onClick={event => {
298+
event.preventDefault();
299+
setConfirmIsOpen(true);
300+
}}
288301
>
289302
<Translate i18nKey="ra.action.clear_array_input">
290303
Clear

0 commit comments

Comments
 (0)