Skip to content

feat: Add allColorModes option to axe tests#978

Merged
GZolla merged 3 commits into
mainfrom
gzolla/axe-allcolormodes
May 7, 2026
Merged

feat: Add allColorModes option to axe tests#978
GZolla merged 3 commits into
mainfrom
gzolla/axe-allcolormodes

Conversation

@GZolla
Copy link
Copy Markdown
Contributor

@GZolla GZolla commented May 7, 2026

@GZolla GZolla requested a review from a team as a code owner May 7, 2026 17:28
Comment thread src/server/wtr-config.js
Comment on lines +62 to +141
const HTML_BODY = testFramework => `
<body>
${TEST_PAGE}
${SUPPRESS_RESIZE_OBSERVER_ERRORS}
<script type="module" src="${testFramework}"></script>
</body>
`;
const HTML_HEAD = `
<head>
<link rel="preload" href="${FONT_ASSETS}Lato-400.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="${FONT_ASSETS}Lato-700.woff2" as="font" type="font/woff2" crossorigin>
<style>

html {
--d2l-cursor-resize-inline-end: e-resize;
--d2l-cursor-resize-inline-start: w-resize;
--d2l-document-direction: ltr;
--d2l-inline-end: right;
--d2l-inline-start: left;
--d2l-length-factor: 1;
--d2l-mirror-transform: none;
--d2l-theme-background-color-base: #ffffff;
--d2l-theme-text-color-static-standard: #202122;
font-size: 20px;
}

html[dir="rtl"] * {
--d2l-cursor-resize-inline-end: w-resize;
--d2l-cursor-resize-inline-start: e-resize;
--d2l-document-direction: rtl;
--d2l-inline-end: left;
--d2l-inline-start: right;
--d2l-length-factor: -1;
--d2l-mirror-transform: scale(-1, 1);
}

html[data-color-mode="dark"] {
--d2l-theme-background-color-base: #161718;
--d2l-theme-text-color-static-standard: #cdd5dc;
}

@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: url(${FONT_ASSETS}Lato-400.woff2) format('woff2');
}
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: url(${FONT_ASSETS}Lato-700.woff2) format('woff2');
}

body {
background-color: var(--d2l-theme-background-color-base);
color: var(--d2l-theme-text-color-static-standard);
font-family: 'Lato', sans-serif;
letter-spacing: 0.01rem;
font-size: 0.95rem;
font-weight: 400;
line-height: 1.4rem;
margin: 0;
padding: 38px;
}
body.no-padding {
padding: 0;
}
</style>
</head>
`;
const DEFAULT_TEST_RUNNER_HTML = testFramework => `<!DOCTYPE html>
<html lang="en" data-timezone='${TIMEZONE}'>
${HTML_BODY(testFramework)}
</html>`;
const FULL_TEST_RUNNER_HTML = testFramework => `<!DOCTYPE html>
<html lang="en" data-timezone='${TIMEZONE}'>
${HTML_HEAD}
${HTML_BODY(testFramework)}
</html>`;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Make HTML reusable to set it for axe tests

Comment thread src/server/wtr-config.js
Comment on lines -180 to -184
if (filter) {
config.groups.forEach(group => {
group.files = this.#filterFiles([ group.files ].flat());
});
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I may be missing something but this.#pattern already sets .files to a filtered set of wildcards, doing it again here breaks those wildcards(e.g. axe --filter card was resulting in **/test/+(+(card.axe.js)) which was not matching any files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I ran into this bug the other day -- makes sense!

Copy link
Copy Markdown
Member

@dlockhart dlockhart left a comment

Choose a reason for hiding this comment

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

Nice!

@GZolla GZolla merged commit 813addf into main May 7, 2026
4 of 5 checks passed
@GZolla GZolla deleted the gzolla/axe-allcolormodes branch May 7, 2026 20:50
@d2l-github-release-tokens
Copy link
Copy Markdown

🎉 This PR is included in version 1.43.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants