@@ -15,11 +15,11 @@ const TEXT_LABEL = 'cool text';
15
15
const NO_MATCHES_TEXT : any = 'not-existent-element' ;
16
16
17
17
const getMultipleInstancesFoundMessage = ( value : string ) => {
18
- return `Found multiple elements with accessibilityRole: ${ value } ` ;
18
+ return `Found multiple elements with role: " ${ value } " ` ;
19
19
} ;
20
20
21
21
const getNoInstancesFoundMessage = ( value : string ) => {
22
- return `Unable to find an element with accessibilityRole: ${ value } ` ;
22
+ return `Unable to find an element with role: " ${ value } " ` ;
23
23
} ;
24
24
25
25
const Typography = ( { children, ...rest } : any ) => {
@@ -621,7 +621,7 @@ describe('error messages', () => {
621
621
const { getByRole } = render ( < View /> ) ;
622
622
623
623
expect ( ( ) => getByRole ( 'button' ) ) . toThrowErrorMatchingInlineSnapshot (
624
- `"Unable to find an element with accessibilityRole: button"`
624
+ `"Unable to find an element with role: " button" "`
625
625
) ;
626
626
} ) ;
627
627
@@ -631,7 +631,7 @@ describe('error messages', () => {
631
631
expect ( ( ) =>
632
632
getByRole ( 'button' , { name : 'Save' } )
633
633
) . toThrowErrorMatchingInlineSnapshot (
634
- `"Unable to find an element with accessibilityRole: button, name: Save"`
634
+ `"Unable to find an element with role: " button" , name: " Save" "`
635
635
) ;
636
636
} ) ;
637
637
@@ -641,7 +641,17 @@ describe('error messages', () => {
641
641
expect ( ( ) =>
642
642
getByRole ( 'button' , { name : 'Save' , disabled : true } )
643
643
) . toThrowErrorMatchingInlineSnapshot (
644
- `"Unable to find an element with accessibilityRole: button, name: Save, accessibilityStates: disabled:true"`
644
+ `"Unable to find an element with role: "button", name: "Save", disabled state: true"`
645
+ ) ;
646
+ } ) ;
647
+
648
+ test ( 'gives a descriptive error message when querying with a role, a name and several accessibility state' , ( ) => {
649
+ const { getByRole } = render ( < View /> ) ;
650
+
651
+ expect ( ( ) =>
652
+ getByRole ( 'button' , { name : 'Save' , disabled : true , selected : true } )
653
+ ) . toThrowErrorMatchingInlineSnapshot (
654
+ `"Unable to find an element with role: "button", name: "Save", disabled state: true, selected state: true"`
645
655
) ;
646
656
} ) ;
647
657
@@ -651,7 +661,7 @@ describe('error messages', () => {
651
661
expect ( ( ) =>
652
662
getByRole ( 'button' , { disabled : true } )
653
663
) . toThrowErrorMatchingInlineSnapshot (
654
- `"Unable to find an element with accessibilityRole: button, accessibilityStates: disabled: true"`
664
+ `"Unable to find an element with role: " button", disabled state: true"`
655
665
) ;
656
666
} ) ;
657
667
} ) ;
0 commit comments