|
1 |
| -import rule from '../no-role-presentation-on-focusable'; |
| 1 | +import rule from "../no-role-presentation-on-focusable"; |
2 | 2 | import makeRuleTester from "./makeRuleTester";
|
3 | 3 |
|
4 |
| -makeRuleTester('no-role-presentation-role-on-focusable', rule, { |
5 |
| - valid: [ |
6 |
| - "<button>Submit</button>", |
7 |
| - "<div role='presentation'><button tabindex='-1'>Some text</button></div>", |
8 |
| - "<div><button>Submit</button></div>", |
9 |
| - "<a href='#' tabindex='-1'>link</a>", |
10 |
| - "<button tabindex='-1' role='presentation'>Press</button>", |
11 |
| - "<div role='presentation'><a href='#' tabindex='-1'>Link</a></div>" |
12 |
| - ], |
13 |
| - invalid: [ |
14 |
| - { |
15 |
| - code: "<div role='presentation'><button>Submit</button></div>", |
16 |
| - errors: [{messageId: "default"}] |
17 |
| - }, |
18 |
| - { |
19 |
| - code: "<button type='button' role='presentation'>Submit</button>", |
20 |
| - errors: [{messageId: "default"}] |
21 |
| - }, |
22 |
| - { |
23 |
| - code: "<a href='#' role='presentation'>Link</a>", |
24 |
| - errors: [{messageId: "default"}] |
25 |
| - }, |
26 |
| - { |
27 |
| - code: "<span tabindex='0' role='presentation'><em>Icon</em></span>", |
28 |
| - errors: [{messageId: "default"}] |
29 |
| - } |
30 |
| - ] |
31 |
| -}) |
| 4 | +makeRuleTester("no-role-presentation-role-on-focusable", rule, { |
| 5 | + valid: [ |
| 6 | + "<button>Submit</button>", |
| 7 | + "<div role='presentation'><button tabindex='-1'>Some text</button></div>", |
| 8 | + "<div><button>Submit</button></div>", |
| 9 | + "<a href='#' tabindex='-1'>link</a>", |
| 10 | + "<button tabindex='-1' role='presentation'>Press</button>", |
| 11 | + "<div role='presentation'><a href='#' tabindex='-1'>Link</a></div>" |
| 12 | + ], |
| 13 | + invalid: [ |
| 14 | + { |
| 15 | + code: "<div role='presentation'><button>Submit</button></div>", |
| 16 | + errors: [{ messageId: "default" }] |
| 17 | + }, |
| 18 | + { |
| 19 | + code: "<button type='button' role='presentation'>Submit</button>", |
| 20 | + errors: [{ messageId: "default" }] |
| 21 | + }, |
| 22 | + { |
| 23 | + code: "<a href='#' role='presentation'>Link</a>", |
| 24 | + errors: [{ messageId: "default" }] |
| 25 | + }, |
| 26 | + { |
| 27 | + code: "<span tabindex='0' role='presentation'><em>Icon</em></span>", |
| 28 | + errors: [{ messageId: "default" }] |
| 29 | + } |
| 30 | + ] |
| 31 | +}); |
0 commit comments