Skip to content

Commit 0e69e5d

Browse files
Uncomment test cases after the recent merge.
1 parent 740e75b commit 0e69e5d

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

tests/lib/rules/buttons/menu-button-needs-labelling.test.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@ import rule from "../../../../lib/rules/buttons/menu-button-needs-labelling";
1515

1616
ruleTester.run("menu-button-needs-labelling", rule as unknown as Rule.RuleModule, {
1717
valid: [
18-
// MenuButton with aria-label
1918
`<MenuButton aria-label="Menu options" />`,
20-
// MenuButton with text content
2119
`<MenuButton>Options</MenuButton>`,
22-
// MenuButton with aria-labelledby that references existing element
2320
`<><Label id="menu-label">Menu</Label><MenuButton aria-labelledby="menu-label" /></>`,
24-
// MenuButton wrapped in Tooltip
25-
`<Tooltip content="Menu options" relationship="label"><MenuButton /></Tooltip>`
26-
// TODO: Uncomment when hasLabeledChild is implemented
27-
// MenuButton with labeled child
28-
// `<MenuButton><img alt="Menu icon" /></MenuButton>`,
29-
// MenuButton with Icon child
30-
// `<MenuButton><MenuIcon /></MenuButton>`
21+
`<Tooltip content="Menu options" relationship="label"><MenuButton /></Tooltip>`,
22+
`<MenuButton><img alt="Menu icon" /></MenuButton>`,
23+
`<MenuButton><MenuIcon /></MenuButton>`
3124
],
3225
invalid: [
3326
{

tests/lib/rules/card-needs-accessible-name.test.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,10 @@ import rule from "../../../lib/rules/card-needs-accessible-name";
1515

1616
ruleTester.run("card-needs-accessible-name", rule as unknown as Rule.RuleModule, {
1717
valid: [
18-
// Card with aria-label
1918
`<Card aria-label="Product details" />`,
20-
// Card with aria-labelledby that references existing element
21-
`<><Label id="card-label">Product</Label><Card aria-labelledby="card-label" /></>`
22-
// TODO: Uncomment when hasLabeledChild is implemented
23-
// Card with labeled child
24-
// `<Card><img alt="Product image" /></Card>`,
25-
// Card with Icon child
26-
// `<Card><ProductIcon /></Card>`
19+
`<><Label id="card-label">Product</Label><Card aria-labelledby="card-label" /></>`,
20+
`<Card><img alt="Product image" /></Card>`,
21+
`<Card><ProductIcon /></Card>`
2722
],
2823
invalid: [
2924
{

tests/lib/rules/infolabel-needs-labelling.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@ import rule from "../../../lib/rules/infolabel-needs-labelling";
1515

1616
ruleTester.run("infolabel-needs-labelling", rule as unknown as Rule.RuleModule, {
1717
valid: [
18-
// InfoLabel with aria-label
1918
`<InfoLabel aria-label="Additional information" />`,
20-
// InfoLabel with text content
2119
`<InfoLabel>Help text</InfoLabel>`,
2220
`<InfoLabel>?</InfoLabel>`,
2321
`<InfoLabel>ℹ️</InfoLabel>`,
24-
// InfoLabel with aria-labelledby that references existing element
2522
`<><Label id="info-label">Information</Label><InfoLabel aria-labelledby="info-label" /></>`,
26-
// InfoLabel wrapped in Tooltip
27-
`<Tooltip content="Help information" relationship="label"><InfoLabel /></Tooltip>`
28-
// TODO: Uncomment when hasLabeledChild is implemented
29-
// InfoLabel with labeled child
30-
// `<InfoLabel><img alt="Help icon" /></InfoLabel>`,
31-
// InfoLabel with Icon child
32-
// `<InfoLabel><InfoIcon /></InfoLabel>`
23+
`<Tooltip content="Help information" relationship="label"><InfoLabel /></Tooltip>`,
24+
`<InfoLabel><img alt="Help icon" /></InfoLabel>`,
25+
`<InfoLabel><InfoIcon /></InfoLabel>`
3326
],
3427
invalid: [
3528
{
@@ -49,9 +42,16 @@ ruleTester.run("infolabel-needs-labelling", rule as unknown as Rule.RuleModule,
4942
errors: [{ messageId: "infoLabelNeedsLabelling" }]
5043
},
5144
{
52-
// aria-labelledby references ID that doesn't exist
5345
code: `<><Label id="wrong-id">Information</Label><InfoLabel aria-labelledby="info-label" /></>`,
5446
errors: [{ messageId: "infoLabelNeedsLabelling" }]
47+
},
48+
{
49+
code: `<InfoLabel><img /></InfoLabel>`,
50+
errors: [{ messageId: "infoLabelNeedsLabelling" }]
51+
},
52+
{
53+
code: `<InfoLabel><img alt="" /></InfoLabel>`,
54+
errors: [{ messageId: "infoLabelNeedsLabelling" }]
5555
}
5656
]
5757
});

0 commit comments

Comments
 (0)