From 91a8fbe2868840535d46491d6140620f917b639e Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Mon, 17 May 2021 08:47:28 +0200 Subject: [PATCH] SIA R12: Add Test (#800) * Pass tests for R12 implemented, starting with failed * Update rule.spec.tsx * Test rule 12 finished * Apply suggestions from code review Co-authored-by: Jean-Yves Moyen * Text sintax improved Co-authored-by: Jean-Yves Moyen --- .../alfa-rules/test/sia-r12/rule.spec.tsx | 31 +++++++++---------- packages/alfa-rules/tsconfig.json | 1 + 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/alfa-rules/test/sia-r12/rule.spec.tsx b/packages/alfa-rules/test/sia-r12/rule.spec.tsx index bf1e8609a3..a3de061309 100644 --- a/packages/alfa-rules/test/sia-r12/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r12/rule.spec.tsx @@ -1,15 +1,16 @@ -import { h } from "@siteimprove/alfa-dom"; import { test } from "@siteimprove/alfa-test"; +import { Document } from "@siteimprove/alfa-dom"; + import R12, { Outcomes } from "../../src/sia-r12/rule"; import { evaluate } from "../common/evaluate"; import { passed, failed, inapplicable } from "../common/outcome"; -test(`evaluates() passes a ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [ passed(R12, target, { @@ -18,11 +19,10 @@ test(`evaluates() passes a ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [ passed(R12, target, { @@ -47,7 +46,7 @@ test(`evaluates() passes a ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [ failed(R12, target, { @@ -59,7 +58,7 @@ test(`evaluates() fails a button with no accessible name`, async (t) => { test(`evaluates() fails an element with \`button\` role without an accessible name`, async (t) => { const target = ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [ failed(R12, target, { @@ -71,23 +70,23 @@ test(`evaluates() fails an element with \`button\` role without an accessible na test(`evaluate() is inapplicable to image buttons`, async (t) => { const target = ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [inapplicable(R12)]); }); -test(`evaluate() is inapplicable to element with no button role`, async (t) => { +test(`evaluate() is inapplicabile to element with no button role`, async (t) => { const target =
Press Here
; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [inapplicable(R12)]); }); -test(`evaluate() is inapplicable to button element with none role`, async (t) => { +test(`evaluate() is inapplicabile to button element with none role`, async (t) => { const target = ; - const document = h.document([target]); + const document = Document.of([target]); t.deepEqual(await evaluate(R12, { document }), [inapplicable(R12)]); }); diff --git a/packages/alfa-rules/tsconfig.json b/packages/alfa-rules/tsconfig.json index 98852d0859..497a731eaf 100644 --- a/packages/alfa-rules/tsconfig.json +++ b/packages/alfa-rules/tsconfig.json @@ -167,6 +167,7 @@ "test/sia-r9/rule.spec.tsx", "test/sia-r10/rule.spec.tsx", "test/sia-r11/rule.spec.tsx", + "test/sia-r12/rule.spec.tsx", "test/sia-r13/rule.spec.tsx", "test/sia-r14/rule.spec.tsx", "test/sia-r15/rule.spec.tsx",