Skip to content

Commit

Permalink
chore(achecker): update accessibility-checker ruleset (#13840)
Browse files Browse the repository at this point in the history
* chore(achecker): update accessibility-checker ruleset

* fix(aChecker): update deps and fix avt tests

* fix(aChecker): track latest ruleset

* chore: yarn dedupe

---------

Co-authored-by: Francine Lucca <40550942+francinelucca@users.noreply.github.com>
  • Loading branch information
tay1orjones and francinelucca authored May 25, 2023
1 parent 023ae6a commit b016d02
Show file tree
Hide file tree
Showing 50 changed files with 364 additions and 81 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion achecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const path = require('path');

module.exports = {
ruleArchive: '21September2022',
ruleArchive: 'latest',
policies: ['Custom_Ruleset'],
failLevels: ['violation'],
reportLevels: [
Expand Down
11 changes: 6 additions & 5 deletions config/jest-config-carbon/matchers/toHaveNoACViolations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ async function toHaveNoACViolations(node, label) {
aChecker = require('accessibility-checker');

const denylist = new Set([
'WCAG20_Html_HasLang',
'WCAG20_Doc_HasTitle',
'WCAG20_Body_FirstASkips_Native_Host_Sematics',
'RPT_Html_SkipNav',
'Rpt_Aria_OrphanedContent_Native_Host_Sematics',
'html_lang_exists',
'page_title_exists',
'skip_main_exists',
'html_skipnav_exists',
'aria_content_in_landmark',
'aria_child_tabbable',
]);
const ruleset = await aChecker.getRuleset('IBM_Accessibility');
const customRuleset = JSON.parse(JSON.stringify(ruleset));
Expand Down
2 changes: 1 addition & 1 deletion config/jest-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/runtime": "^7.18.3",
"accessibility-checker": "^3.1.32",
"accessibility-checker": "^3.1.48",
"axe-core": "^4.3.5",
"babel-jest": "^28.1.0",
"chalk": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion e2e/components/ContentSwitcher/ContentSwitcher-test.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ test.describe('ContentSwitcher', () => {
theme: 'white',
},
});
await expect(page).toHaveNoACViolations('ContentSwitcher');
await expect(page).toHaveNoACViolations('ContentSwitcher-IconOnly');
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"accessibility-checker": "^3.1.32",
"accessibility-checker": "^3.1.48",
"all-contributors-cli": "^6.19.0",
"cross-env": "^7.0.0",
"cross-spawn": "^7.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ beforeEach(() => {
wrapper = render(<TestComponent />);
});

async function a11y(label) {
it('should have no Axe violations', async () => {
await expect(wrapper.container).toHaveNoAxeViolations();
});

it('should have no Accessibility Checker violations', async () => {
await expect(wrapper.container).toHaveNoACViolations(label);
});
}

describe('ContainedList', () => {
it('list and label ids match', () => {
// eslint-disable-next-line testing-library/prefer-screen-queries
Expand Down Expand Up @@ -85,8 +75,6 @@ describe('ContainedList', () => {
expect(wrapper.container.firstChild).toHaveClass(className);
});

a11y('ContainedList');

it('should render ExpandableSearch as an action', () => {
render(
<ContainedList
Expand Down Expand Up @@ -189,7 +177,5 @@ describe('ContainedListItem', () => {

expect(content.tagName).toBe('BUTTON');
});

a11y('ContainedListItem, interactive');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,4 @@ describe('ContentSwitcher - RTL', () => {
);
});
});

describe('automated verification testing', () => {
it('should have no aXe violations', async () => {
const { container } = render(
<ContentSwitcher>
<Switch kind="anchor" text="one" />
<Switch kind="anchor" text="two" />
</ContentSwitcher>
);
await expect(container).toHaveNoAxeViolations();
});

it('should have no AC violations', async () => {
const { container } = render(
<ContentSwitcher>
<Switch kind="anchor" text="one" />
<Switch kind="anchor" text="two" />
</ContentSwitcher>
);
await expect(container).toHaveNoACViolations('ContentSwitcher');
});
});
});
3 changes: 1 addition & 2 deletions packages/react/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ const Modal = React.forwardRef(function Modal(
<div
id={modalBodyId}
className={contentClasses}
{...hasScrollingContentProps}
aria-labelledby={getAriaLabelledBy}>
{...hasScrollingContentProps}>
{children}
</div>
{hasScrollingContent && (
Expand Down
12 changes: 7 additions & 5 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ expect.extend({
if (!aChecker) {
aChecker = require('accessibility-checker');
const denylist = new Set([
'WCAG20_Html_HasLang',
'WCAG20_Doc_HasTitle',
'WCAG20_Body_FirstASkips_Native_Host_Sematics',
'RPT_Html_SkipNav',
'Rpt_Aria_OrphanedContent_Native_Host_Sematics',
'html_lang_exists',
'page_title_exists',
'skip_main_exists',
'html_skipnav_exists',
'aria_content_in_landmark',
'aria_child_tabbable',
]);

const ruleset = await aChecker.getRuleset('IBM_Accessibility');
const customRuleset = JSON.parse(JSON.stringify(ruleset));

Expand Down
Loading

0 comments on commit b016d02

Please sign in to comment.