Permalink
Cannot retrieve contributors at this time
39 lines (38 sloc)
1.3 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/isAbstractRole-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 { elementType } from 'jsx-ast-utils'; | |
import isAbstractRole from '../../../src/util/isAbstractRole'; | |
import { | |
genElementSymbol, | |
genAbstractRoleElements, | |
genNonAbstractRoleElements, | |
} from '../../../__mocks__/genInteractives'; | |
describe('isAbstractRole', () => { | |
describe('JSX Components (no tagName)', () => { | |
it('should NOT identify them as abstract role elements', () => { | |
expect(isAbstractRole(undefined, [])) | |
.toBe(false); | |
}); | |
}); | |
describe('elements with an abstract role', () => { | |
genAbstractRoleElements().forEach(({ openingElement }) => { | |
const { attributes } = openingElement; | |
it(`should identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => { | |
expect(isAbstractRole( | |
elementType(openingElement), | |
attributes, | |
)).toBe(true); | |
}); | |
}); | |
}); | |
describe('elements with a non-abstract role', () => { | |
genNonAbstractRoleElements().forEach(({ openingElement }) => { | |
const { attributes } = openingElement; | |
it(`should NOT identify \`${genElementSymbol(openingElement)}\` as an abstract role element`, () => { | |
expect(isAbstractRole( | |
elementType(openingElement), | |
attributes, | |
)).toBe(false); | |
}); | |
}); | |
}); | |
}); |