Skip to content

Commit

Permalink
feat: adding test
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoPieroni committed Sep 2, 2024
1 parent 7e108c0 commit f7c60d9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`<div style="background: white; color: black;">
<p style="font-size: 12px; font-weight: 400;">Some copy</p>
<p style="font-size: 16px; font-weight: 600;">Some copy</p>
</div>`,
);

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);
});
});
});

0 comments on commit f7c60d9

Please sign in to comment.