From 224265d5df35b04a85ae9f35e0943553df42e49f Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Fri, 7 May 2021 16:26:14 +0200 Subject: [PATCH 1/5] Pass tests for R12 implemented, starting with failed --- .../alfa-rules/test/sia-r12/rule.spec.tsx | 56 +++++++++++++++++++ packages/alfa-rules/tsconfig.json | 1 + 2 files changed, 57 insertions(+) create mode 100644 packages/alfa-rules/test/sia-r12/rule.spec.tsx diff --git a/packages/alfa-rules/test/sia-r12/rule.spec.tsx b/packages/alfa-rules/test/sia-r12/rule.spec.tsx new file mode 100644 index 0000000000..a0da7a0952 --- /dev/null +++ b/packages/alfa-rules/test/sia-r12/rule.spec.tsx @@ -0,0 +1,56 @@ +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 = Document.of([target]); + + t.deepEqual(await evaluate(R12, { document }), [ + passed(R12, target, { + 1: Outcomes.HasName, + }), + ]); +}); + +test(`evaluates() passes an input element with accessible value attribute `, async (t) => { + const input = ; + + const document = Document.of([input]); + + t.deepEqual(await evaluate(R12, { document }), [ + passed(R12, input, { + 1: Outcomes.HasName, + }), + ]); +}); + +test(`evaluates() passes a ; + + const document = Document.of([target]); + + t.deepEqual(await evaluate(R12, { document }), [ + passed(R12, target, { + 1: Outcomes.HasName, + }), + ]); +}); + +test(`evaluates() fails ; + + const document = Document.of([target]); + + t.deepEqual(await evaluate(R12, { document }), [ + failed(R12, target, { + 1: Outcomes.HasNoName, + }), + ]); +}); diff --git a/packages/alfa-rules/tsconfig.json b/packages/alfa-rules/tsconfig.json index e94faed657..73829bc9e9 100644 --- a/packages/alfa-rules/tsconfig.json +++ b/packages/alfa-rules/tsconfig.json @@ -161,6 +161,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", From 96041c2d5eaca2a8b87c7bd9aba35f494a5fa496 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Tue, 11 May 2021 12:30:46 +0200 Subject: [PATCH 2/5] Update rule.spec.tsx --- .../alfa-rules/test/sia-r12/rule.spec.tsx | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/packages/alfa-rules/test/sia-r12/rule.spec.tsx b/packages/alfa-rules/test/sia-r12/rule.spec.tsx index a0da7a0952..891ba3914d 100644 --- a/packages/alfa-rules/test/sia-r12/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r12/rule.spec.tsx @@ -54,3 +54,39 @@ test(`evaluates() fails ; + + const document = Document.of([target]); + + t.deepEqual(await evaluate(R12, { document }), [ + failed(R12, target, { + 1: Outcomes.HasNoName, + }), + ]); +}); + +test(`evaluates() fails element with ; + + const document = Document.of([target]); + + t.deepEqual(await evaluate(R12, { document }), [inapplicable(R12)]); +}); From a561f378b2f7d355ceb1a42c6e203776de46f328 Mon Sep 17 00:00:00 2001 From: elenamongelli <52746406+elenamongelli@users.noreply.github.com> Date: Tue, 11 May 2021 14:43:56 +0200 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Jean-Yves Moyen --- .../alfa-rules/test/sia-r12/rule.spec.tsx | 39 +++---------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/packages/alfa-rules/test/sia-r12/rule.spec.tsx b/packages/alfa-rules/test/sia-r12/rule.spec.tsx index 5792d4aadd..237cf3720c 100644 --- a/packages/alfa-rules/test/sia-r12/rule.spec.tsx +++ b/packages/alfa-rules/test/sia-r12/rule.spec.tsx @@ -19,7 +19,7 @@ test(`evaluates() passes a ; const document = Document.of([target]); @@ -43,7 +43,7 @@ test(`evaluates() passes a ; const document = Document.of([target]); @@ -55,19 +55,8 @@ test(`evaluates() fails ; - const document = Document.of([target]); - - t.deepEqual(await evaluate(R12, { document }), [ - failed(R12, target, { - 1: Outcomes.HasNoName, - }), - ]); -}); - -test(`evaluates() fails element with