File tree Expand file tree Collapse file tree 4 files changed +8
-2
lines changed
__tests__/src/util/implicitRoles Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,7 @@ describe('isAbstractRole', () => {
2929 it ( 'works for the default case' , ( ) => {
3030 expect ( getImplicitRoleForInput ( [ JSXAttributeMock ( 'type' , '' ) ] ) ) . toBe ( 'textbox' ) ;
3131 } ) ;
32+ it ( 'works for the true case' , ( ) => {
33+ expect ( getImplicitRoleForInput ( [ JSXAttributeMock ( 'type' , true ) ] ) ) . toBe ( 'textbox' ) ;
34+ } ) ;
3235} ) ;
Original file line number Diff line number Diff line change @@ -16,4 +16,7 @@ describe('isAbstractRole', () => {
1616 it ( 'works for non-toolbars' , ( ) => {
1717 expect ( getImplicitRoleForMenuitem ( [ JSXAttributeMock ( 'type' , '' ) ] ) ) . toBe ( '' ) ;
1818 } ) ;
19+ it ( 'works for the true case' , ( ) => {
20+ expect ( getImplicitRoleForMenuitem ( [ JSXAttributeMock ( 'type' , true ) ] ) ) . toBe ( '' ) ;
21+ } ) ;
1922} ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default function getImplicitRoleForInput(attributes) {
99 if ( type ) {
1010 const value = getLiteralPropValue ( type ) || '' ;
1111
12- switch ( value . toUpperCase ( ) ) {
12+ switch ( typeof value === 'string' && value . toUpperCase ( ) ) {
1313 case 'BUTTON' :
1414 case 'IMAGE' :
1515 case 'RESET' :
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default function getImplicitRoleForMenuitem(attributes) {
99 if ( type ) {
1010 const value = getLiteralPropValue ( type ) || '' ;
1111
12- switch ( value . toUpperCase ( ) ) {
12+ switch ( typeof value === 'string' && value . toUpperCase ( ) ) {
1313 case 'COMMAND' :
1414 return 'menuitem' ;
1515 case 'CHECKBOX' :
You can’t perform that action at this time.
0 commit comments