@@ -167,19 +167,26 @@ describe('Attribute Editor', () => {
167
167
test ( 'enables the add button by default' , ( ) => {
168
168
const wrapper = renderAttributeEditor ( { ...defaultProps } ) ;
169
169
const buttonElement = wrapper . findAddButton ( ) . getElement ( ) ;
170
- expect ( buttonElement ) . not . toHaveAttribute ( 'disabled' ) ;
170
+ expect ( buttonElement ) . not . toHaveAttribute ( 'aria- disabled' ) ;
171
171
} ) ;
172
172
173
173
test ( 'enables the add button when disableAddButton is false' , ( ) => {
174
174
const wrapper = renderAttributeEditor ( { ...defaultProps , disableAddButton : false } ) ;
175
175
const buttonElement = wrapper . findAddButton ( ) . getElement ( ) ;
176
- expect ( buttonElement ) . not . toHaveAttribute ( 'disabled' ) ;
176
+ expect ( buttonElement ) . not . toHaveAttribute ( 'aria- disabled' ) ;
177
177
} ) ;
178
178
179
179
test ( 'disables the add button when disableAddButton is true' , ( ) => {
180
180
const wrapper = renderAttributeEditor ( { ...defaultProps , disableAddButton : true } ) ;
181
181
const buttonElement = wrapper . findAddButton ( ) . getElement ( ) ;
182
- expect ( buttonElement ) . toHaveAttribute ( 'disabled' ) ;
182
+ expect ( buttonElement ) . toHaveAttribute ( 'aria-disabled' ) ;
183
+ } ) ;
184
+
185
+ test ( 'allows the add button to be focused manually when disableAddButton is true' , ( ) => {
186
+ const ref : React . Ref < AttributeEditorProps . Ref > = React . createRef ( ) ;
187
+ const wrapper = renderAttributeEditor ( { ...defaultProps , ref, disableAddButton : true } ) ;
188
+ ref . current ! . focusAddButton ( ) ;
189
+ expect ( wrapper . findAddButton ( ) . getElement ( ) ) . toHaveFocus ( ) ;
183
190
} ) ;
184
191
185
192
test ( 'has no aria-describedby if there is no additional info' , ( ) => {
0 commit comments