diff --git a/packages/alfa-rules/test/sia-r18/rule.spec.tsx b/packages/alfa-rules/test/sia-r18/rule.spec.tsx index fac9820e68..a48454e4dc 100644 --- a/packages/alfa-rules/test/sia-r18/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r18/rule.spec.tsx @@ -1,6 +1,7 @@ -import { h } from "@siteimprove/alfa-dom"; import { test } from "@siteimprove/alfa-test"; +import { Document } from "@siteimprove/alfa-dom"; + import R18, { Outcomes } from "../../src/sia-r18/rule"; import { evaluate } from "../common/evaluate"; @@ -9,7 +10,7 @@ import { passed, failed, inapplicable } from "../common/outcome"; test(`evaluate() passes a button with aria-pressed state`, async (t) => { const target = ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-pressed").get(), { @@ -18,14 +19,14 @@ test(`evaluate() passes a button with aria-pressed state`, async (t) => { ]); }); -test(`evaluate() passes a div element with button role, and an aria-pressed state`, async (t) => { +test(`evaluate() passes a div element with button role, whose has aria-pressed state`, async (t) => { const target = (
My button
); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-pressed").get(), { @@ -37,7 +38,7 @@ test(`evaluate() passes a div element with button role, and an aria-pressed stat test(`evaluate() passes a div element with aria busy state`, async (t) => { const target =
My busy div
; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-busy").get(), { @@ -46,14 +47,14 @@ test(`evaluate() passes a div element with aria busy state`, async (t) => { ]); }); -test(`evaluate() passes a div element with button role, and an aria-label attribute`, async (t) => { +test(`evaluate() passes a div element with button role, whose has aria-label state`, async (t) => { const target = (
); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-label").get(), { @@ -62,14 +63,14 @@ test(`evaluate() passes a div element with button role, and an aria-label attrib ]); }); -test(`evaluate() passes a div element with checkbox role, and an aria-checked state`, async (t) => { +test(`evaluate() passes a div element with checkbox role, whose has aria-checked state`, async (t) => { const target = (
My checkbox
); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-checked").get(), { @@ -78,14 +79,14 @@ test(`evaluate() passes a div element with checkbox role, and an aria-checked st ]); }); -test(`evaluate() passes a div element with checkbox role, and an aria-controls state`, async (t) => { +test(`evaluate() passes a div element with checkbox role, whose has aria-controls state`, async (t) => { const target = ( ); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-controls").get(), { @@ -97,15 +98,14 @@ test(`evaluate() passes a div element with checkbox role, and an aria-controls s ]); }); -test(`evaluate() passes a div element with checkbox role, and both - aria-controls and aria-expanded states`, async (t) => { +test(`evaluate() passes a div element with checkbox role, whose has aria-controls and aria-expanded state`, async (t) => { const target = ( ); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-controls").get(), { @@ -117,15 +117,14 @@ test(`evaluate() passes a div element with checkbox role, and both ]); }); -test(`evaluate() passes a div element with checkbox role, with both - aria-expanded and empty aria-controls state`, async (t) => { +test(`evaluate() passes a div element with checkbox role, whose has aria-expanded and aria-controls (empty) state`, async (t) => { const target = ( ); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-expanded").get(), { @@ -137,14 +136,14 @@ test(`evaluate() passes a div element with checkbox role, with both ]); }); -test(`evaluate() passes a button element with none role and aria-pressed`, async (t) => { +test(`evaluate() passes a button element with none role and aria pressed`, async (t) => { const target = ( ); - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ passed(R18, target.attribute("aria-pressed").get(), { @@ -153,10 +152,10 @@ test(`evaluate() passes a button element with none role and aria-pressed`, async ]); }); -test(`evaluate() fails a button with aria-sort state, and no property`, async (t) => { +test(`evaluate() fails a button with aria-sort state, but it doesn't have any property`, async (t) => { const target = ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [ failed(R18, target.attribute("aria-sort").get(), { @@ -165,10 +164,10 @@ test(`evaluate() fails a button with aria-sort state, and no property`, async (t ]); }); -test(`evaluate() is inapplicable for a div element with no aria attribute`, async (t) => { +test(`evaluate() is inapplicable for a div element with no aria state / property`, async (t) => { const target =
A region of content
; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R18, { document }), [inapplicable(R18)]); }); diff --git a/packages/alfa-rules/tsconfig.json b/packages/alfa-rules/tsconfig.json index 640808d37c..7b7f499ffc 100644 --- a/packages/alfa-rules/tsconfig.json +++ b/packages/alfa-rules/tsconfig.json @@ -173,6 +173,7 @@ "test/sia-r15/rule.spec.tsx", "test/sia-r16/rule.spec.tsx", "test/sia-r17/rule.spec.tsx", + "test/sia-r18/rule.spec.tsx", "test/sia-r21/rule.spec.tsx", "test/sia-r24/rule.spec.tsx", "test/sia-r38/rule.spec.tsx",