Skip to content

Commit 18de89f

Browse files
author
MattAgn
committed
test: add implicit accessible test
1 parent 56347ce commit 18de89f

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/queries/__tests__/role.breaking.test.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,22 @@ test('byRole queries support hidden option', () => {
739739
);
740740
});
741741

742-
test('takes accessible prop into account', () => {
743-
const { queryByRole } = render(
744-
<Pressable accessibilityRole="button" accessible={false}>
745-
<Text>Action</Text>
746-
</Pressable>
747-
);
748-
expect(queryByRole('button', { name: 'Action' })).toBeFalsy();
742+
describe('matches only accessible elements', () => {
743+
test('takes explicit accessible prop into account', () => {
744+
const { queryByRole } = render(
745+
<Pressable accessibilityRole="button" accessible={false}>
746+
<Text>Action</Text>
747+
</Pressable>
748+
);
749+
expect(queryByRole('button', { name: 'Action' })).toBeFalsy();
750+
});
751+
752+
test('takes implicit accessible value into account', () => {
753+
const { queryByRole } = render(
754+
<View accessibilityRole="menu">
755+
<Text>Action</Text>
756+
</View>
757+
);
758+
expect(queryByRole('menu', { name: 'Action' })).toBeFalsy();
759+
});
749760
});

0 commit comments

Comments
 (0)