From f7c60d92c46cd3d4cff139b06fa4d73f2c30fbb9 Mon Sep 17 00:00:00 2001 From: Matteo Pieroni Date: Mon, 2 Sep 2024 15:59:43 +0100 Subject: [PATCH] feat: adding test --- src/index.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/index.test.ts b/src/index.test.ts index d5010a8..b281e17 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -235,5 +235,22 @@ describe("apca-check", () => { await expect(apcaViolations[0].nodes.length).to.equal(3); }); + + it("should handle both valid code and violations", async () => { + const el: HTMLElement = await fixture( + html`
+

Some copy

+

Some copy

+
`, + ); + + const results = await runAxe(el); + + const apcaViolations = results.violations.filter((violation) => + violation.id.includes("color-contrast-apca-silver"), + ); + + await expect(apcaViolations[0].nodes.length).to.equal(1); + }); }); });