Skip to content

Commit 8d7c09e

Browse files
feat: upgrade aria-query to 5.3.0
1 parent 491e930 commit 8d7c09e

File tree

5 files changed

+27
-45
lines changed

5 files changed

+27
-45
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@babel/code-frame": "^7.10.4",
6363
"@babel/runtime": "^7.12.5",
6464
"@types/aria-query": "^5.0.1",
65-
"aria-query": "5.1.3",
65+
"aria-query": "^5.3.0",
6666
"chalk": "^4.1.0",
6767
"dom-accessibility-api": "^0.5.9",
6868
"lz-string": "^1.5.0",

src/__tests__/__snapshots__/role-helpers.js.snap

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,6 @@ Name "":
5252
data-testid="a-article"
5353
/>
5454
55-
--------------------------------------------------
56-
command:
57-
58-
Name "":
59-
<menuitem
60-
data-testid="a-menuitem-1"
61-
/>
62-
63-
Name "":
64-
<menuitem
65-
data-testid="a-menuitem-2"
66-
/>
67-
68-
--------------------------------------------------
69-
menuitem:
70-
71-
Name "":
72-
<menuitem
73-
data-testid="a-menuitem-1"
74-
/>
75-
76-
Name "":
77-
<menuitem
78-
data-testid="a-menuitem-2"
79-
/>
80-
8155
--------------------------------------------------
8256
list:
8357

src/__tests__/role-helpers.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function setup() {
1919
<header data-testid="a-header">Banner header</header>
2020
<section aria-label="a region" data-testid='named-section'>
2121
<a href="http://whatever.com" data-testid="a-link">link</a>
22-
<a>invalid link</a>
22+
<a data-testid="invalid-link">invalid link</a>
2323
2424
<nav data-testid='a-nav' />
2525
@@ -28,14 +28,6 @@ function setup() {
2828
<h3 data-testid='a-h3'>Tertiary Heading</h3>
2929
3030
<article data-testid='a-article'>
31-
<!-- menuitem is currently deprecated, but is the only
32-
tag currently that aria-query returns multiple roles for
33-
(roles: command, menuitem).
34-
It's used here in case a future tag also has multiple
35-
roles -->
36-
<menuitem data-testid='a-menuitem-1'>1</menuitem>
37-
<menuitem data-testid='a-menuitem-2'>2</menuitem>
38-
3931
<ul data-testid='a-list'>
4032
<li data-testid='a-list-item-1'>Item 1</li>
4133
<li data-testid='a-list-item-2'>Item 2</li>
@@ -78,13 +70,12 @@ function setup() {
7870
unnamedSection: getByTestId('a-section'),
7971
namedSection: getByTestId('named-section'),
8072
anchor: getByTestId('a-link'),
73+
invalidAnchor: getByTestId('invalid-link'),
8174
h1: getByTestId('a-h1'),
8275
h2: getByTestId('a-h2'),
8376
h3: getByTestId('a-h3'),
8477
nav: getByTestId('a-nav'),
8578
article: getByTestId('a-article'),
86-
menuItem: getByTestId('a-menuitem-1'),
87-
menuItem2: getByTestId('a-menuitem-2'),
8879
aUl: getByTestId('a-list'),
8980
aLi1: getByTestId('a-list-item-1'),
9081
aLi2: getByTestId('a-list-item-2'),
@@ -112,14 +103,14 @@ function setup() {
112103

113104
test('getRoles returns expected roles for various dom nodes', () => {
114105
const {
106+
unnamedSection,
115107
anchor,
108+
invalidAnchor,
116109
h1,
117110
h2,
118111
h3,
119112
nav,
120113
article,
121-
menuItem,
122-
menuItem2,
123114
aUl,
124115
aLi1,
125116
aLi2,
@@ -146,6 +137,7 @@ test('getRoles returns expected roles for various dom nodes', () => {
146137

147138
expect(getRoles(namedSection)).toEqual({
148139
link: [anchor],
140+
generic: [invalidAnchor, unnamedSection],
149141
heading: [h1, h2, h3],
150142
navigation: [nav],
151143
radio: [radio, radio2],
@@ -157,8 +149,6 @@ test('getRoles returns expected roles for various dom nodes', () => {
157149
cell: [td1, td2, td3],
158150
textbox: [input, input2, textarea],
159151
rowgroup: [tbody],
160-
command: [menuItem, menuItem2],
161-
menuitem: [menuItem, menuItem2],
162152
form: [namedForm],
163153
region: [namedSection],
164154
term: [dt],

src/__tests__/role.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ test('accessible name comparison is case sensitive', () => {
248248
<h1 />
249249
250250
--------------------------------------------------
251+
emphasis:
252+
253+
Name "":
254+
<em />
255+
256+
--------------------------------------------------
251257
252258
Ignored nodes: comments, script, style
253259
<div>
@@ -296,6 +302,12 @@ test('TextMatch serialization in error message', () => {
296302
<h1 />
297303
298304
--------------------------------------------------
305+
emphasis:
306+
307+
Name "":
308+
<em />
309+
310+
--------------------------------------------------
299311
300312
Ignored nodes: comments, script, style
301313
<div>
@@ -320,6 +332,12 @@ test('TextMatch serialization in error message', () => {
320332
<h1 />
321333
322334
--------------------------------------------------
335+
emphasis:
336+
337+
Name "":
338+
<em />
339+
340+
--------------------------------------------------
323341
324342
Ignored nodes: comments, script, style
325343
<div>

src/__tests__/suggestions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ test('escapes regular expressions in suggestion', () => {
196196
const {container} = renderIntoDocument(`
197197
<label for="superInput">inp-t lab^l w{th c+ars to esc\\pe</label>
198198
<input id="superInput" type="text" value="my super string +-('{}^$)" placeholder="should escape +-'(/" />
199-
<p>
199+
<span>
200200
Loading ... (1)
201-
</p>
201+
</span>
202202
<img src="foo.png" alt="The Problem (picture of a question mark)" data-testid="foo" />
203203
`)
204204

@@ -214,7 +214,7 @@ test('escapes regular expressions in suggestion', () => {
214214
).toString(),
215215
).toEqual(`getByAltText(/the problem \\(picture of a question mark\\)/i)`)
216216

217-
expect(getSuggestedQuery(container.querySelector('p')).toString()).toEqual(
217+
expect(getSuggestedQuery(container.querySelector('span')).toString()).toEqual(
218218
`getByText(/loading \\.\\.\\. \\(1\\)/i)`,
219219
)
220220

0 commit comments

Comments
 (0)