File tree 4 files changed +8
-2
lines changed
__tests__/src/util/implicitRoles 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,7 @@ describe('isAbstractRole', () => {
29
29
it ( 'works for the default case' , ( ) => {
30
30
expect ( getImplicitRoleForInput ( [ JSXAttributeMock ( 'type' , '' ) ] ) ) . toBe ( 'textbox' ) ;
31
31
} ) ;
32
+ it ( 'works for the true case' , ( ) => {
33
+ expect ( getImplicitRoleForInput ( [ JSXAttributeMock ( 'type' , true ) ] ) ) . toBe ( 'textbox' ) ;
34
+ } ) ;
32
35
} ) ;
Original file line number Diff line number Diff line change @@ -16,4 +16,7 @@ describe('isAbstractRole', () => {
16
16
it ( 'works for non-toolbars' , ( ) => {
17
17
expect ( getImplicitRoleForMenuitem ( [ JSXAttributeMock ( 'type' , '' ) ] ) ) . toBe ( '' ) ;
18
18
} ) ;
19
+ it ( 'works for the true case' , ( ) => {
20
+ expect ( getImplicitRoleForMenuitem ( [ JSXAttributeMock ( 'type' , true ) ] ) ) . toBe ( '' ) ;
21
+ } ) ;
19
22
} ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default function getImplicitRoleForInput(attributes) {
9
9
if ( type ) {
10
10
const value = getLiteralPropValue ( type ) || '' ;
11
11
12
- switch ( value . toUpperCase ( ) ) {
12
+ switch ( typeof value === 'string' && value . toUpperCase ( ) ) {
13
13
case 'BUTTON' :
14
14
case 'IMAGE' :
15
15
case 'RESET' :
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default function getImplicitRoleForMenuitem(attributes) {
9
9
if ( type ) {
10
10
const value = getLiteralPropValue ( type ) || '' ;
11
11
12
- switch ( value . toUpperCase ( ) ) {
12
+ switch ( typeof value === 'string' && value . toUpperCase ( ) ) {
13
13
case 'COMMAND' :
14
14
return 'menuitem' ;
15
15
case 'CHECKBOX' :
You can’t perform that action at this time.
0 commit comments