Skip to content

Commit

Permalink
add more test coverage of roles
Browse files Browse the repository at this point in the history
  • Loading branch information
khiga8 committed Jul 12, 2023
1 parent 5a66033 commit aaca700
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/utils/get-role.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ describe('getRole', function () {
expect(getRole({}, submit)).to.equal('button')
})

it('returns rowheader role for <th scope="row">', function () {
const node = mockJSXOpeningElement('th', [mockJSXAttribute('scope', 'row')])
expect(getRole({}, node)).to.equal('rowheader')
})

it('returns rowheader role for <th scope="rowgroup">', function () {
const node = mockJSXOpeningElement('th', [mockJSXAttribute('scope', 'rowgroup')])
expect(getRole({}, node)).to.equal('rowheader')
})

// Hard-coded mapping
it('returns listitem role for <li>', function () {
const node = mockJSXOpeningElement('li')
expect(getRole({}, node)).to.equal('listitem')
})

it('returns complementary role for <aside>', function () {
const node = mockJSXOpeningElement('aside')
expect(getRole({}, node)).to.equal('complementary')
})

// <link> does not map to anything.
it('returns undefined role for <link>', function () {
const node = mockJSXOpeningElement('link')
Expand Down

0 comments on commit aaca700

Please sign in to comment.