Skip to content

Commit 7390abf

Browse files
committed
add test to validate toBeDisabled with parent elements
1 parent 3c29061 commit 7390abf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/matchers/__tests__/to-be-disabled.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ describe('.toBeDisabled', () => {
6969
});
7070
});
7171

72+
Object.entries(ALL_COMPONENTS).forEach(([name, Component]) => {
73+
test(`handle when parent element is disabled for element ${name}`, () => {
74+
const { queryByTestId } = render(
75+
<View aria-disabled={true}>
76+
<View>
77+
{/* @ts-expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604) */}
78+
<Component testID={name}>
79+
<TextInput />
80+
</Component>
81+
</View>
82+
</View>
83+
);
84+
85+
expect(queryByTestId(name)).toBeDisabled();
86+
});
87+
});
88+
7289
test('handle editable prop for TextInput', () => {
7390
const { getByTestId, getByPlaceholderText } = render(
7491
<View>

0 commit comments

Comments
 (0)