Skip to content

Commit b12cda5

Browse files
committed
Add more tests for getRole
1 parent ba52aca commit b12cda5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/utils/get-role.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,31 @@ describe('getRole', function () {
107107
expect(getRole({}, h6)).to.equal('heading')
108108
})
109109

110+
it('returns navigation role for <nav>', function () {
111+
const node = mockJSXOpeningElement('nav')
112+
expect(getRole({}, node)).to.equal('navigation')
113+
})
114+
115+
it('returns option role for <opt>', function () {
116+
const node = mockJSXOpeningElement('option')
117+
expect(getRole({}, node)).to.equal('option')
118+
})
119+
120+
it('returns textbox role for <textarea>', function () {
121+
const node = mockJSXOpeningElement('textarea')
122+
expect(getRole({}, node)).to.equal('textbox')
123+
})
124+
125+
it('returns listbox role for <select>', function () {
126+
const node = mockJSXOpeningElement('textarea')
127+
expect(getRole({}, node)).to.equal('textbox')
128+
})
129+
130+
it('returns group role for <details>', function () {
131+
const node = mockJSXOpeningElement('details')
132+
expect(getRole({}, node)).to.equal('group')
133+
})
134+
110135
// <link> does not map to anything.
111136
it('returns undefined role for <link>', function () {
112137
const node = mockJSXOpeningElement('link')

0 commit comments

Comments
 (0)