Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 540e6ad

Browse files
ajsmthbcarroll22
authored andcommitted
#72 feat(a11y): update valid accessibility roles (#74)
* feat: formatting options for render() to remove options from debug output * update name -- propsToRemove to just removeProps * omitProps: remove prettyPrint plugin in favour of removing props in toJSON() call * update options in render() to destructure debug config * update valid accessibilityRole values Closes #72
1 parent a8ba416 commit 540e6ad

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

src/lib/__tests__/queries.find.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ test('find asynchronously finds elements', async () => {
3838
<Image accessibilityHint="test-hint" src="/lucy-ricardo.png" />
3939
<View accessibilityRole="dialog" />
4040
<View accessibilityRole="fake" />
41+
<View accessibilityRole="tablist" />
42+
<View accessibilityRole="tab" />
4143
</View>,
4244
);
4345

@@ -77,8 +79,14 @@ test('find asynchronously finds elements', async () => {
7779
await expect(findByRole('none')).resolves.toBeTruthy();
7880
await expect(findAllByRole('none')).resolves.toHaveLength(1);
7981

80-
await expect(findByRole(['none'])).resolves.toBeTruthy();
81-
await expect(findAllByRole(['none'])).resolves.toHaveLength(1);
82+
await expect(findByRole('tablist')).resolves.toBeTruthy();
83+
await expect(findAllByRole('tablist')).resolves.toHaveLength(1);
84+
85+
await expect(findByRole('tablist')).resolves.toBeTruthy();
86+
await expect(findAllByRole('tablist')).resolves.toHaveLength(1);
87+
88+
await expect(findByRole('tab')).resolves.toBeTruthy();
89+
await expect(findAllByRole('tab')).resolves.toHaveLength(1);
8290

8391
await expect(findByRole('fake', {}, { timeout: 50 })).rejects.toThrow();
8492

src/lib/queries/role.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
import { buildQueries } from './all-utils';
22

33
const validRoles = [
4-
'adjustable',
4+
'none',
55
'button',
6-
'header',
7-
'image',
8-
'imagebutton',
9-
'keyboardKey',
106
'link',
11-
'none',
127
'search',
13-
'summary',
8+
'image',
9+
'keyboardkey',
1410
'text',
11+
'adjustable',
12+
'imagebutton',
13+
'header',
14+
'summary',
15+
'alert',
16+
'checkbox',
17+
'combobox',
18+
'menu',
19+
'menubar',
20+
'menuitem',
21+
'progressbar',
22+
'radio',
23+
'radiogroup',
24+
'scrollbar',
25+
'spinbutton',
26+
'switch',
27+
'tab',
28+
'tablist',
29+
'timer',
30+
'toolbar',
1531
];
1632

1733
const validTraits = [

0 commit comments

Comments
 (0)