[LON-CAPA-cvs] cvs: loncom /node.js/axe axeperl.js
raeburn
raeburn at source.lon-capa.org
Sat Jul 25 08:10:18 EDT 2026
raeburn Sat Jul 25 12:10:18 2026 EDT
Modified files:
/loncom/node.js/axe axeperl.js
Log:
- Add tags for lesser WCAG standard(a) and level(s) since in axe-core
tags are neither cumulative nor cascading.
Index: loncom/node.js/axe/axeperl.js
diff -u loncom/node.js/axe/axeperl.js:1.2 loncom/node.js/axe/axeperl.js:1.3
--- loncom/node.js/axe/axeperl.js:1.2 Thu Jul 16 00:36:01 2026
+++ loncom/node.js/axe/axeperl.js Sat Jul 25 12:10:18 2026
@@ -1,5 +1,5 @@
//
-// $Id: axeperl.js,v 1.2 2026/07/16 00:36:01 raeburn Exp $
+// $Id: axeperl.js,v 1.3 2026/07/25 12:10:18 raeburn Exp $
//
// This is a javascript library for accessibility testing of
// LON-CAPA resources rendered for the web target. It relies
@@ -82,12 +82,29 @@
async function getViolations(url) {
let tags = [];
if (wcag === '2') {
- tags = [wcag+level];
+ if (level === 'aa') {
+ tags = ['wcag2a'];
+ } else if (level === 'aaa') {
+ tags = ['wcag2a', 'wcag2aa'];
+ }
} else if (wcag === '21') {
- tags = ['wcag2'+level, wcag+level];
+ if (level === 'a') {
+ tags = ['wcag2a'];
+ } else if (level === 'aa') {
+ tags = ['wcag2a', 'wcag2aa', 'wcag21a'];
+ } else if (level === 'aaa') {
+ tags = ['wcag2a', 'wcag2aa', 'wcag2aaa', 'wcag21a', 'wcag21aa'];
+ }
} else if (wcag === '22') {
- tags = ['wcag2'+level, 'wcag21'+level, wcag+level];
+ if (level === 'a') {
+ tags = ['wcag2a', 'wcag21a'];
+ } else if (level === 'aa') {
+ tags = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22a'];
+ } else if (level === 'aaa') {
+ tags = ['wcag2a', 'wcag2aa', 'wcag2aaa', 'wcag21a', 'wcag21aa', 'wcag21aaa', 'wcag22a', 'wcag22aa'];
+ }
}
+ tags.push('wcag'+wcag+level);
const page = await browser.newPage();
await page.goto(url);
const results = await new AxePuppeteer(page).withTags(tags).analyze();
More information about the LON-CAPA-cvs
mailing list