Permalink
Cannot retrieve contributors at this time
71 lines (69 sloc)
1.86 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/eslint-plugin-jsx-a11y/__tests__/src/util/getComputedRole-test.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import expect from 'expect'; | |
import getComputedRole from '../../../src/util/getComputedRole'; | |
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock'; | |
describe('getComputedRole', () => { | |
describe('explicit role', () => { | |
describe('valid role', () => { | |
it('should return the role', () => { | |
expect(getComputedRole( | |
'div', | |
[JSXAttributeMock('role', 'button')], | |
)).toBe('button'); | |
}); | |
}); | |
describe('invalid role', () => { | |
describe('has implicit', () => { | |
it('should return the implicit role', () => { | |
expect(getComputedRole( | |
'li', | |
[JSXAttributeMock('role', 'beeswax')], | |
)).toBe('listitem'); | |
}); | |
}); | |
describe('lacks implicit', () => { | |
it('should return null', () => { | |
expect(getComputedRole( | |
'div', | |
[JSXAttributeMock('role', 'beeswax')], | |
)).toBeNull(); | |
}); | |
}); | |
}); | |
describe('no role', () => { | |
describe('has implicit', () => { | |
it('should return the implicit role', () => { | |
expect(getComputedRole( | |
'li', | |
[], | |
)).toBe('listitem'); | |
}); | |
}); | |
describe('lacks implicit', () => { | |
it('should return null', () => { | |
expect(getComputedRole( | |
'div', | |
[], | |
)).toBeNull(); | |
}); | |
}); | |
}); | |
}); | |
describe('implicit role', () => { | |
describe('has implicit', () => { | |
it('should return the implicit role', () => { | |
expect(getComputedRole( | |
'li', | |
[JSXAttributeMock('role', 'beeswax')], | |
)).toBe('listitem'); | |
}); | |
}); | |
describe('lacks implicit', () => { | |
it('should return null', () => { | |
expect(getComputedRole( | |
'div', | |
[], | |
)).toBeNull(); | |
}); | |
}); | |
}); | |
}); |