@@ -27,10 +27,6 @@ function setup() {
27
27
<h2 data-testid='a-h2'>Sub Heading</h2>
28
28
<h3 data-testid='a-h3'>Tertiary Heading</h3>
29
29
30
- <img src="http://example.com/image.png" data-testid='a-img-1'/>
31
- <img alt="" src="http://example.com/image.png" data-testid='a-img-2'/>
32
- <img alt="a meaningful description" src="http://example.com/image.png" data-testid='a-img-3'/>
33
-
34
30
<article data-testid='a-article'>
35
31
<ul data-testid='a-list'>
36
32
<li data-testid='a-list-item-1'>Item 1</li>
@@ -62,25 +58,25 @@ function setup() {
62
58
63
59
<form data-testid="a-form" />
64
60
<section data-testid="a-section" />
65
- </article>
66
- <dl>
61
+ </article>
62
+ <dl>
67
63
<dt data-testid="a-dt">Term</dt>
68
64
<dd data-testid="a-dd">Definition</dd>
69
- </dl>
65
+ </dl>
66
+
67
+ <img src="http://example.com/image.png" data-testid='a-img-1'/>
68
+ <img alt="" src="http://example.com/image.png" data-testid='a-img-2'/>
69
+ <img alt="a meaningful description" src="http://example.com/image.png" data-testid='a-img-3'/>
70
70
</section>
71
71
` )
72
72
73
73
return {
74
74
unnamedSection : getByTestId ( 'a-section' ) ,
75
75
namedSection : getByTestId ( 'named-section' ) ,
76
76
anchor : getByTestId ( 'a-link' ) ,
77
- invalidAnchor : getByTestId ( 'invalid-link' ) ,
78
77
h1 : getByTestId ( 'a-h1' ) ,
79
78
h2 : getByTestId ( 'a-h2' ) ,
80
79
h3 : getByTestId ( 'a-h3' ) ,
81
- unnamedImg : getByTestId ( 'a-img-1' ) ,
82
- presentationImg : getByTestId ( 'a-img-2' ) ,
83
- namedImg : getByTestId ( 'a-img-3' ) ,
84
80
nav : getByTestId ( 'a-nav' ) ,
85
81
article : getByTestId ( 'a-article' ) ,
86
82
aUl : getByTestId ( 'a-list' ) ,
@@ -105,20 +101,19 @@ function setup() {
105
101
dt : getByTestId ( 'a-dt' ) ,
106
102
dd : getByTestId ( 'a-dd' ) ,
107
103
header : getByTestId ( 'a-header' ) ,
104
+ invalidAnchor : getByTestId ( 'invalid-link' ) ,
105
+ unnamedImg : getByTestId ( 'a-img-1' ) ,
106
+ presentationImg : getByTestId ( 'a-img-2' ) ,
107
+ namedImg : getByTestId ( 'a-img-3' ) ,
108
108
}
109
109
}
110
110
111
111
test ( 'getRoles returns expected roles for various dom nodes' , ( ) => {
112
112
const {
113
- unnamedSection,
114
113
anchor,
115
- invalidAnchor,
116
114
h1,
117
115
h2,
118
116
h3,
119
- unnamedImg,
120
- presentationImg,
121
- namedImg,
122
117
nav,
123
118
article,
124
119
aUl,
@@ -143,13 +138,16 @@ test('getRoles returns expected roles for various dom nodes', () => {
143
138
dd,
144
139
dt,
145
140
header,
141
+ invalidAnchor,
142
+ unnamedSection,
143
+ unnamedImg,
144
+ presentationImg,
145
+ namedImg,
146
146
} = setup ( )
147
147
148
148
expect ( getRoles ( namedSection ) ) . toEqual ( {
149
149
link : [ anchor ] ,
150
- generic : [ invalidAnchor , unnamedSection ] ,
151
150
heading : [ h1 , h2 , h3 ] ,
152
- img : [ unnamedImg , namedImg ] ,
153
151
navigation : [ nav ] ,
154
152
radio : [ radio , radio2 ] ,
155
153
article : [ article ] ,
@@ -164,6 +162,8 @@ test('getRoles returns expected roles for various dom nodes', () => {
164
162
region : [ namedSection ] ,
165
163
term : [ dt ] ,
166
164
definition : [ dd ] ,
165
+ generic : [ invalidAnchor , unnamedSection ] ,
166
+ img : [ unnamedImg , namedImg ] ,
167
167
presentation : [ presentationImg ] ,
168
168
} )
169
169
expect ( getRoles ( header ) ) . toEqual ( {
0 commit comments