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

[WIP] [DO NOT MERGE] v4.1.3 diff #3

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
da2deae
changed package name to denote DAISY fork
danielweck Jan 19, 2021
bdcf58d
initial patching (scripts/axe-patch-is-aria-role-allowed.js scripts/a…
danielweck Jan 19, 2021
5830ea9
Mocha fast bail
danielweck Jan 19, 2021
8b3740d
semver is same as Axe Core but with DAISY addon suffix. Also added NP…
danielweck Jan 19, 2021
723b98a
semver is reflected in auto-generated doc
danielweck Jan 19, 2021
2e70235
added unit tests for implicit/explicit and DPUB role parsing
danielweck Jan 19, 2021
4ce706d
Scoped NPM package name, and files selection for NPM publish
danielweck Jan 19, 2021
1c9a0b2
NPM public publish
danielweck Jan 19, 2021
6590f7f
Merge branch 'v4.1.1_DAISY' into v4.1.2_DAISY
danielweck Feb 16, 2021
ea67596
rules MD
danielweck Feb 16, 2021
e04a57a
ignore epub:type
danielweck Feb 18, 2021
af3e209
Merge branch 'v4.1.2_DAISY' into v4.1.3_DAISY
danielweck Mar 10, 2021
161d97e
Unit tests require package.json version without canary or arbitrary e…
danielweck Mar 10, 2021
2a6ab7e
landmark-one-main now with page-no-duplicate-main in addition to page…
danielweck Mar 10, 2021
dae726f
doc: landmark-one-main now with page-no-duplicate-main in addition to…
danielweck Mar 10, 2021
2b5bb2d
intermediary commit (Axe hook seems to stash things in the working co…
danielweck Mar 10, 2021
6121f22
main element and div with role
danielweck Mar 10, 2021
10be613
added unit test for landmark-no-duplicate-main to pass content with n…
danielweck Mar 10, 2021
72707cf
matching-aria-role check port (untranslated)
danielweck Mar 10, 2021
45529c1
epub-type-has-matching-role pagebreak-label ported from Ace (translat…
danielweck Mar 10, 2021
5e5e6a7
working XHTML unit tests for EPUB in Axe! (port from Ace)
danielweck Mar 11, 2021
e460f1d
page-break label test (check)
danielweck Mar 11, 2021
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
Prev Previous commit
Next Next commit
intermediary commit (Axe hook seems to stash things in the working co…
…py ... so I need to test a full commit)
danielweck committed Mar 10, 2021
commit 2b5bb2d1f990644d731109f37a921cc3bba449c1
46 changes: 24 additions & 22 deletions build/test/get-test-urls.js
Original file line number Diff line number Diff line change
@@ -2,33 +2,35 @@ const globby = require('globby');

const getTestUrls = async (host = `localhost`, port = `9876`) => {
const urls = [
/**
* Unit tests -> Core
*/
`http://${host}:${port}/test/core/`,
/**
* Unit tests -> Checks
*/
`http://${host}:${port}/test/checks/`,
/**
* Unit tests -> Matches
*/
`http://${host}:${port}/test/rule-matches/`,
/**
* Unit tests -> Commons
*/
`http://${host}:${port}/test/commons/`,
/**
* Integration tests -> rules
*/
`http://${host}:${port}/test/integration/rules`,
// /**
// * Unit tests -> Core
// */
// `http://${host}:${port}/test/core/`,
// /**
// * Unit tests -> Checks
// */
// `http://${host}:${port}/test/checks/`,
// /**
// * Unit tests -> Matches
// */
// `http://${host}:${port}/test/rule-matches/`,
// /**
// * Unit tests -> Commons
// */
// `http://${host}:${port}/test/commons/`,
// /**
// * Integration tests -> rules
// */
// `http://${host}:${port}/test/integration/rules`,
/**
* Integration tests -> full
*/
...(
await globby([
'test/integration/full/**/*.html',
'!test/integration/full/**/frames/**/*.html'
'test/integration/full/landmark-one-main/**/*.html',
'!test/integration/full/landmark-one-main/**/frames/**/*.html'
// 'test/integration/full/**/*.html',
// '!test/integration/full/**/frames/**/*.html'
])
).map(file => `http://${host}:${port}/${file}`)
];
21 changes: 14 additions & 7 deletions lib/checks/aria/aria-required-children-evaluate.js
Original file line number Diff line number Diff line change
@@ -10,22 +10,29 @@ import { hasContentVirtual, idrefs } from '../../commons/dom';
* Get all owned roles of an element
*/
function getOwnedRoles(virtualNode) {
const parentRole = getRole(virtualNode, { dpub: true });
// DAISY-AXE
// const parentRole = getRole(virtualNode, { dpub: true });

const ownedRoles = [];
const ownedElements = getOwnedVirtual(virtualNode);
for (let i = 0; i < ownedElements.length; i++) {
let ownedElement = ownedElements[i];
let role = getRole(ownedElement, { dpub: true });

// DAISY-AXE
// let role = getRole(ownedElement, { dpub: true });
let role = getRole(ownedElement);

// if owned node has no role or is presentational we keep
// parsing the descendant tree. this means intermediate roles
// between a required parent and child will fail the check
if (
['presentation', 'none', null].includes(role) ||
(['list'].includes(role) &&
['doc-bibliography', 'doc-endnotes'].includes(parentRole))
) {

// DAISY-AXE
// if (
// ['presentation', 'none', null].includes(role) ||
// (['list'].includes(role) &&
// ['doc-bibliography', 'doc-endnotes'].includes(parentRole))
// ) {
if (['presentation', 'none', null].includes(role)) {
ownedElements.push(...ownedElement.children);
} else if (role) {
ownedRoles.push(role);
12 changes: 8 additions & 4 deletions lib/checks/lists/listitem-evaluate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { getComposedParent } from '../../commons/dom';
import { getRoleType, isValidRole } from '../../commons/aria';

// DAISY-AXE
// import { getRoleType, isValidRole } from '../../commons/aria';
import { isValidRole } from '../../commons/aria';

function listitemEvaluate(node) {
const parent = getComposedParent(node);
@@ -16,9 +19,10 @@ function listitemEvaluate(node) {
}

if (parentRole && isValidRole(parentRole)) {
if (getRoleType(parentRole) === 'list') {
return true;
}
// DAISY-AXE
// if (getRoleType(parentRole) === 'list') {
// return true;
// }

this.data({
messageKey: 'roleNotValid'
12 changes: 9 additions & 3 deletions lib/checks/lists/only-listitems-evaluate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { isVisible } from '../../commons/dom';
import { getRole, getRoleType } from '../../commons/aria';

// DAISY-AXE
// import { getRole, getRoleType } from '../../commons/aria';
import { getRole } from '../../commons/aria';

function onlyListitemsEvaluate(node, options, virtualNode) {
let hasNonEmptyTextNode = false;
@@ -24,8 +27,11 @@ function onlyListitemsEvaluate(node, options, virtualNode) {
isEmpty = false;
const isLi = actualNode.nodeName.toUpperCase() === 'LI';
const role = getRole(vNode);
const isListItemRole =
role === 'listitem' || getRoleType(role) === 'listitem';

// DAISY-AXE
// const isListItemRole =
// role === 'listitem' || getRoleType(role) === 'listitem';
const isListItemRole = role === 'listitem';

if (!isLi && !isListItemRole) {
badNodes.push(actualNode);
2 changes: 1 addition & 1 deletion lib/commons/aria/get-element-unallowed-roles.js
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ function getRoleSegments(node) {
roles = roles.concat(nodeRoles);
}

// EPUB epub:type should be ignored
// DAISY-AXE (EPUB epub:type should be ignored)
// if (node.hasAttributeNS('http://www.idpf.org/2007/ops', 'type')) {
// const epubRoles = tokenList(
// node.getAttributeNS('http://www.idpf.org/2007/ops', 'type').toLowerCase()