Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions packages/lib/src/text-input/TextInput.accessibility.test.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { render } from "@testing-library/react";
import { axe, formatRules } from "../../test/accessibility/axe-helper";
import { axe } from "../../test/accessibility/axe-helper";
import DxcTextInput from "./TextInput";
import MockDOMRect from "../../test/mocks/domRectMock";
import { vi } from "vitest";

// TODO: REMOVE
import rules from "../../test/accessibility/rules/specific/resultset-table/disabledRules";

const disabledRules = {
rules: formatRules(rules),
};

const countries = [
"Afghanistan",
"Albania",
Expand Down Expand Up @@ -77,7 +70,7 @@ describe("TextInput component accessibility tests", () => {
clearable
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for autocomplete mode", async () => {
Expand All @@ -100,7 +93,7 @@ describe("TextInput component accessibility tests", () => {
autocomplete="on"
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for suggestions mode", async () => {
Expand All @@ -123,7 +116,7 @@ describe("TextInput component accessibility tests", () => {
suggestions={countries}
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for pattern mode", async () => {
Expand All @@ -146,7 +139,7 @@ describe("TextInput component accessibility tests", () => {
pattern='^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[!&$%&? "]).*$'
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for optional mode", async () => {
Expand All @@ -169,7 +162,7 @@ describe("TextInput component accessibility tests", () => {
optional
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for error mode", async () => {
Expand All @@ -192,7 +185,7 @@ describe("TextInput component accessibility tests", () => {
clearable
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for read-only mode", async () => {
Expand All @@ -214,7 +207,7 @@ describe("TextInput component accessibility tests", () => {
readOnly
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
it("Should not have basic accessibility issues for disabled mode", async () => {
Expand All @@ -235,7 +228,7 @@ describe("TextInput component accessibility tests", () => {
disabled
/>
);
const results = await axe(baseElement, disabledRules);
const results = await axe(baseElement);
expect(results.violations).toHaveLength(0);
});
});
2 changes: 0 additions & 2 deletions packages/lib/test/accessibility/rules/common/disabledRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const disabledRules = [
"region",
// Disable label rule to prevent error from inputs that have no label on purpose (even though it is not really recommended for accessibility)
"label",
// TODO: REMOVE
"color-contrast",
];

export default disabledRules;
Loading