Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(components): separate a11y tests (VIV-2312) #2124

Open
wants to merge 52 commits into
base: main
Choose a base branch
from

Conversation

TaylorJ76
Copy link
Contributor

  • Moves component axe test into a separate *.a11y.spec.ts file
  • Adds a new command to run the a11y tests npm run test:a11y or npx nx run components:a11y
  • Updates the component generator files with the new a11y test file

@TaylorJ76 TaylorJ76 changed the title Viv 2312 separate a11y tests chore(components): separate a11y tests (VIV-2312) Feb 6, 2025
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d61b119) to head (bbd2c72).
Report is 1268 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##              main     #2124      +/-   ##
============================================
  Coverage   100.00%   100.00%              
============================================
  Files          123       373     +250     
  Lines         1562     16101   +14539     
  Branches       108      2915    +2807     
============================================
+ Hits          1562     16101   +14539     
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@YonatanKra YonatanKra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one issue I found with the banner in which the tests were removed and not moved, and it caused the coverage to drop (it caught a true positive :) ).
I believe all the places where there were non-axe tests should be checked and make sure they were not removed.
In addition, there's now an issue with listbox.length. Because we don't have tests for our foundation, we need to at least test this API through its extenders (our components), so we need to find who's extending foundation/listbox and make sure there's a test for length.
We are already supposed to take care of foundation during our tech debt tasks, so no need for a overhaul (the PR is already huge as is).

Comment on lines 328 to 342
it('should change role to role text', async function () {
element.role = 'alert';
await elementUpdated(element);
const role = getBannerMessageAttribute(element, 'role');
expect(role).toEqual('alert');
expect(await axe(element)).toHaveNoViolations();
});

it('should change role when role attribute is set', async function () {
element.setAttribute('role', 'alert');
await elementUpdated(element);
const role = getBannerMessageAttribute(element, 'role');
expect(role).toEqual('alert');
expect(await axe(element)).toHaveNoViolations();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these moved someplace? It seems like they were deleted, even though the functionality is still there (hence the coverage is reduced).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants