Skip to content

Commit aaca700

Browse files
committed
add more test coverage of roles
1 parent 5a66033 commit aaca700

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/utils/get-role.js

+21
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,27 @@ describe('getRole', function () {
167167
expect(getRole({}, submit)).to.equal('button')
168168
})
169169

170+
it('returns rowheader role for <th scope="row">', function () {
171+
const node = mockJSXOpeningElement('th', [mockJSXAttribute('scope', 'row')])
172+
expect(getRole({}, node)).to.equal('rowheader')
173+
})
174+
175+
it('returns rowheader role for <th scope="rowgroup">', function () {
176+
const node = mockJSXOpeningElement('th', [mockJSXAttribute('scope', 'rowgroup')])
177+
expect(getRole({}, node)).to.equal('rowheader')
178+
})
179+
180+
// Hard-coded mapping
181+
it('returns listitem role for <li>', function () {
182+
const node = mockJSXOpeningElement('li')
183+
expect(getRole({}, node)).to.equal('listitem')
184+
})
185+
186+
it('returns complementary role for <aside>', function () {
187+
const node = mockJSXOpeningElement('aside')
188+
expect(getRole({}, node)).to.equal('complementary')
189+
})
190+
170191
// <link> does not map to anything.
171192
it('returns undefined role for <link>', function () {
172193
const node = mockJSXOpeningElement('link')

0 commit comments

Comments
 (0)