@@ -27,10 +27,6 @@ function setup() {
2727 <h2 data-testid='a-h2'>Sub Heading</h2>
2828 <h3 data-testid='a-h3'>Tertiary Heading</h3>
2929
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-
3430 <article data-testid='a-article'>
3531 <ul data-testid='a-list'>
3632 <li data-testid='a-list-item-1'>Item 1</li>
@@ -62,25 +58,25 @@ function setup() {
6258
6359 <form data-testid="a-form" />
6460 <section data-testid="a-section" />
65- </article>
66- <dl>
61+ </article>
62+ <dl>
6763 <dt data-testid="a-dt">Term</dt>
6864 <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'/>
7070</section>
7171 ` )
7272
7373 return {
7474 unnamedSection : getByTestId ( 'a-section' ) ,
7575 namedSection : getByTestId ( 'named-section' ) ,
7676 anchor : getByTestId ( 'a-link' ) ,
77- invalidAnchor : getByTestId ( 'invalid-link' ) ,
7877 h1 : getByTestId ( 'a-h1' ) ,
7978 h2 : getByTestId ( 'a-h2' ) ,
8079 h3 : getByTestId ( 'a-h3' ) ,
81- unnamedImg : getByTestId ( 'a-img-1' ) ,
82- presentationImg : getByTestId ( 'a-img-2' ) ,
83- namedImg : getByTestId ( 'a-img-3' ) ,
8480 nav : getByTestId ( 'a-nav' ) ,
8581 article : getByTestId ( 'a-article' ) ,
8682 aUl : getByTestId ( 'a-list' ) ,
@@ -105,20 +101,19 @@ function setup() {
105101 dt : getByTestId ( 'a-dt' ) ,
106102 dd : getByTestId ( 'a-dd' ) ,
107103 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' ) ,
108108 }
109109}
110110
111111test ( 'getRoles returns expected roles for various dom nodes' , ( ) => {
112112 const {
113- unnamedSection,
114113 anchor,
115- invalidAnchor,
116114 h1,
117115 h2,
118116 h3,
119- unnamedImg,
120- presentationImg,
121- namedImg,
122117 nav,
123118 article,
124119 aUl,
@@ -143,13 +138,16 @@ test('getRoles returns expected roles for various dom nodes', () => {
143138 dd,
144139 dt,
145140 header,
141+ invalidAnchor,
142+ unnamedSection,
143+ unnamedImg,
144+ presentationImg,
145+ namedImg,
146146 } = setup ( )
147147
148148 expect ( getRoles ( namedSection ) ) . toEqual ( {
149149 link : [ anchor ] ,
150- generic : [ invalidAnchor , unnamedSection ] ,
151150 heading : [ h1 , h2 , h3 ] ,
152- img : [ unnamedImg , namedImg ] ,
153151 navigation : [ nav ] ,
154152 radio : [ radio , radio2 ] ,
155153 article : [ article ] ,
@@ -164,6 +162,8 @@ test('getRoles returns expected roles for various dom nodes', () => {
164162 region : [ namedSection ] ,
165163 term : [ dt ] ,
166164 definition : [ dd ] ,
165+ generic : [ invalidAnchor , unnamedSection ] ,
166+ img : [ unnamedImg , namedImg ] ,
167167 presentation : [ presentationImg ] ,
168168 } )
169169 expect ( getRoles ( header ) ) . toEqual ( {
0 commit comments