Skip to content

Commit

Permalink
add test to validate toBeDisabled with parent elements
Browse files Browse the repository at this point in the history
  • Loading branch information
jaworek committed Aug 26, 2023
1 parent 3c29061 commit 7390abf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/matchers/__tests__/to-be-disabled.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ describe('.toBeDisabled', () => {
});
});

Object.entries(ALL_COMPONENTS).forEach(([name, Component]) => {
test(`handle when parent element is disabled for element ${name}`, () => {
const { queryByTestId } = render(
<View aria-disabled={true}>
<View>
{/* @ts-expect-error JSX element type 'Component' does not have any construct or call signatures.ts(2604) */}
<Component testID={name}>
<TextInput />
</Component>
</View>
</View>
);

expect(queryByTestId(name)).toBeDisabled();
});
});

test('handle editable prop for TextInput', () => {
const { getByTestId, getByPlaceholderText } = render(
<View>
Expand Down

0 comments on commit 7390abf

Please sign in to comment.