Skip to content

Commit

Permalink
[tests] Add tests to reinforce required attributes for role="heading"
Browse files Browse the repository at this point in the history
Add unit tests to ensure that there are no warnings when role="heading" is used when aria-level is provided. For example, aria-label is not required.
See jsx-eslint#1002
  • Loading branch information
lb- committed Oct 23, 2024
1 parent e5dda96 commit 9d21c3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions __tests__/src/rules/role-has-required-aria-props-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ ruleTester.run('role-has-required-aria-props', rule, {
{ code: '<input role="checkbox" aria-checked="false" aria-labelledby="foo" tabindex="0" {...props} type="checkbox" />' },
{ code: '<input type="checkbox" role="switch" />' },
{ code: '<MyComponent role="checkbox" aria-checked="false" aria-labelledby="foo" tabindex="0" />', settings: componentsSettings },
{ code: '<div role="heading" aria-level={2} />' },
{ code: '<div role="heading" aria-level="3" />' },
)).concat(basicValidityTests).map(parserOptionsMapper),

invalid: parsers.all([].concat(
Expand Down

0 comments on commit 9d21c3e

Please sign in to comment.