File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed
packages/pf4-component-mapper/src Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -95,13 +95,15 @@ const DynamicArray = ({ ...props }) => {
95
95
titleDescription = { description }
96
96
actions = {
97
97
< React . Fragment >
98
- < Button
99
- variant = "link"
100
- isDisabled = { value . length === 0 }
101
- { ...( value . length !== 0 && { onClick : ( ) => removeBatch ( value . map ( ( _ , index ) => index ) ) } ) }
102
- >
103
- { combinedButtonLabels . removeAll }
104
- </ Button >
98
+ { minItems === 0 && (
99
+ < Button
100
+ variant = "link"
101
+ isDisabled = { value . length === 0 }
102
+ { ...( value . length !== 0 && { onClick : ( ) => removeBatch ( value . map ( ( _ , index ) => index ) ) } ) }
103
+ >
104
+ { combinedButtonLabels . removeAll }
105
+ </ Button >
106
+ ) }
105
107
< Button
106
108
variant = "secondary"
107
109
isDisabled = { value . length >= maxItems }
Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ describe('<FieldArray/>', () => {
306
306
} ) ;
307
307
308
308
await act ( async ( ) => {
309
- wrapper . find ( 'button' ) . at ( 1 ) . simulate ( 'click' ) ;
309
+ wrapper . find ( 'button' ) . at ( 0 ) . simulate ( 'click' ) ;
310
310
} ) ;
311
311
wrapper . update ( ) ;
312
312
@@ -321,7 +321,7 @@ describe('<FieldArray/>', () => {
321
321
onSubmit . mockClear ( ) ;
322
322
323
323
await act ( async ( ) => {
324
- wrapper . find ( 'button' ) . at ( 1 ) . simulate ( 'click' ) ;
324
+ wrapper . find ( 'button' ) . at ( 0 ) . simulate ( 'click' ) ;
325
325
} ) ;
326
326
wrapper . update ( ) ;
327
327
@@ -336,7 +336,7 @@ describe('<FieldArray/>', () => {
336
336
onSubmit . mockClear ( ) ;
337
337
338
338
await act ( async ( ) => {
339
- wrapper . find ( 'button' ) . at ( 1 ) . simulate ( 'click' ) ;
339
+ wrapper . find ( 'button' ) . at ( 0 ) . simulate ( 'click' ) ;
340
340
} ) ;
341
341
wrapper . update ( ) ;
342
342
You can’t perform that action at this time.
0 commit comments