@@ -13,15 +13,20 @@ import { render } from '../..';
1313import '../extend-expect' ;
1414
1515const ALLOWED_COMPONENTS = {
16- View,
17- TextInput,
1816 TouchableHighlight,
1917 TouchableOpacity,
2018 TouchableWithoutFeedback,
2119 TouchableNativeFeedback,
2220 Pressable,
2321} ;
2422
23+ const ARIA_COMPONENTS = {
24+ View,
25+ TextInput,
26+ } ;
27+
28+ const ALL_COMPONENTS = { ...ALLOWED_COMPONENTS , ...ARIA_COMPONENTS } ;
29+
2530describe ( '.toBeDisabled' , ( ) => {
2631 Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
2732 test ( `handle disabled prop for element ${ name } ` , ( ) => {
@@ -37,7 +42,20 @@ describe('.toBeDisabled', () => {
3742 } ) ;
3843 } ) ;
3944
40- Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
45+ Object . entries ( ARIA_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
46+ test ( `handle aria-disabled prop for element ${ name } ` , ( ) => {
47+ const { queryByTestId } = render (
48+ < Component aria-disabled testID = { name } >
49+ < TextInput />
50+ </ Component >
51+ ) ;
52+
53+ expect ( queryByTestId ( name ) ) . toBeDisabled ( ) ;
54+ expect ( ( ) => expect ( queryByTestId ( name ) ) . not . toBeDisabled ( ) ) . toThrow ( ) ;
55+ } ) ;
56+ } ) ;
57+
58+ Object . entries ( ALL_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
4159 test ( `handle disabled in accessibilityState for element ${ name } ` , ( ) => {
4260 const { queryByTestId } = render (
4361 //@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
@@ -76,7 +94,7 @@ describe('.toBeDisabled', () => {
7694} ) ;
7795
7896describe ( '.toBeEnabled' , ( ) => {
79- Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
97+ Object . entries ( ALL_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
8098 test ( `handle disabled prop for element ${ name } when undefined` , ( ) => {
8199 const { queryByTestId } = render (
82100 //@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
@@ -90,7 +108,7 @@ describe('.toBeEnabled', () => {
90108 } ) ;
91109 } ) ;
92110
93- Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
111+ Object . entries ( ALL_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
94112 test ( `handle disabled in accessibilityState for element ${ name } when false` , ( ) => {
95113 const { queryByTestId } = render (
96114 //@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
0 commit comments