@@ -13,15 +13,20 @@ import { render } from '../..';
13
13
import '../extend-expect' ;
14
14
15
15
const ALLOWED_COMPONENTS = {
16
- View,
17
- TextInput,
18
16
TouchableHighlight,
19
17
TouchableOpacity,
20
18
TouchableWithoutFeedback,
21
19
TouchableNativeFeedback,
22
20
Pressable,
23
21
} ;
24
22
23
+ const ARIA_COMPONENTS = {
24
+ View,
25
+ TextInput,
26
+ } ;
27
+
28
+ const ALL_COMPONENTS = { ...ALLOWED_COMPONENTS , ...ARIA_COMPONENTS } ;
29
+
25
30
describe ( '.toBeDisabled' , ( ) => {
26
31
Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
27
32
test ( `handle disabled prop for element ${ name } ` , ( ) => {
@@ -37,7 +42,20 @@ describe('.toBeDisabled', () => {
37
42
} ) ;
38
43
} ) ;
39
44
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 ] ) => {
41
59
test ( `handle disabled in accessibilityState for element ${ name } ` , ( ) => {
42
60
const { queryByTestId } = render (
43
61
//@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
@@ -76,7 +94,7 @@ describe('.toBeDisabled', () => {
76
94
} ) ;
77
95
78
96
describe ( '.toBeEnabled' , ( ) => {
79
- Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
97
+ Object . entries ( ALL_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
80
98
test ( `handle disabled prop for element ${ name } when undefined` , ( ) => {
81
99
const { queryByTestId } = render (
82
100
//@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
@@ -90,7 +108,7 @@ describe('.toBeEnabled', () => {
90
108
} ) ;
91
109
} ) ;
92
110
93
- Object . entries ( ALLOWED_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
111
+ Object . entries ( ALL_COMPONENTS ) . forEach ( ( [ name , Component ] ) => {
94
112
test ( `handle disabled in accessibilityState for element ${ name } when false` , ( ) => {
95
113
const { queryByTestId } = render (
96
114
//@ts -expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604)
0 commit comments