Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions accessibility-checker-engine/ace-sr-add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

new ace.SRViewer();
22 changes: 22 additions & 0 deletions accessibility-checker-engine/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
collectCoverage: true,
mapCoverage: true
// transformIgnorePatterns: [
// "ace-node\\.js"
// ]
};

/*
"preset": "ts-jest",
"transformIgnorePatterns": [
"ace-node\\.js"
],
"transform": {
"^.+\\.ts$": "ts-jest"
}
*/
8 changes: 6 additions & 2 deletions accessibility-checker-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"build-node": "npm run prebuild && npx webpack --config webpack-node.config.js && shx cp dist/index.d.ts dist/ace-node.d.ts",
"build-node-debug": "npm run prebuild && npx webpack --config webpack-node-debug.config.js && shx cp dist/index.d.ts dist/ace-node-debug.d.ts",
"build": "npm run prebuild && npx webpack --config webpack.config.js && shx cp dist/index.d.ts dist/ace.d.ts && cat dist/ace.js ace-window-add.js >dist/ace-window.js",
"build-debug": "npm run prebuild && npx webpack --config webpack-debug.config.js && shx cp dist/index.d.ts dist/ace-debug.d.ts && cat dist/ace-debug.js ace-window-add.js >dist/ace-window-debug.js",
"build": "npm run prebuild && npx webpack --config webpack.config.js && shx cp dist/index.d.ts dist/ace.d.ts && cat dist/ace.js ace-window-add.js >dist/ace-window.js && cat dist/ace.js ace-sr-add.js >dist/ace-sr.js",
"build-debug": "npm run prebuild && npx webpack --config webpack-debug.config.js && shx cp dist/index.d.ts dist/ace-debug.d.ts && cat dist/ace-debug.js ace-window-add.js >dist/ace-window-debug.js && cat dist/ace-debug.js ace-sr-add.js >dist/ace-sr-debug.js",
"prebuild": "ts-node src/genRuleIndex.ts",
"test": "npm run prebuild && karma start",
"serve": "serve .",
Expand All @@ -17,10 +17,13 @@
"author": "IBM",
"license": "SEE LICENSE IN LICENSE from the 'equal-access' repository",
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^18.15.3",
"chai": "^4.3.4",
"coverage-istanbul-loader": "^3.0.5",
"express": "^4.17.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^30.0.0-beta.3",
"karma": "^6.3.9",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
Expand All @@ -34,6 +37,7 @@
"karma-webpack": "^5.0.0",
"mocha": "^9.1.3",
"shx": "^0.3.3",
"ts-jest": "^29.3.4",
"ts-loader": "^9.2.6",
"ts-node": "^10.5.0",
"typescript": "^4.5.4",
Expand Down
3 changes: 3 additions & 0 deletions accessibility-checker-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export { Checker }
export { ARIAMapper } from "./v2/aria/ARIAMapper";
export { Config } from "./v2/config/Config";
export { DOMWalker } from "./v2/dom/DOMWalker";
export { SRController } from "./v4/simulator/SRController";
export { SRCursor } from "./v4/simulator/SRCursor";
export { SRViewer } from "./v4/simulator/SRViewer";

String.prototype.startsWith = String.prototype.startsWith || function (str) {
return this.indexOf(str) === 0;
Expand Down
2 changes: 1 addition & 1 deletion accessibility-checker-engine/src/v2/aria/ARIAMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class ARIAMapper extends CommonMapper {
// https://www.w3.org/TR/html-aam-1.0/#mapping-html-to-accessibility-apis
public static elemAttrValueCalculators: { [nodeName:string]: { [attr:string]: string | ElemCalc }} = {
"global": {
"name": AccNameUtil.computeAccessibleName //ARIAMapper.computeName
"name": elem => AccNameUtil.computeAccessibleName(elem)?.name //ARIAMapper.computeName
}
, "datalist": {
// set to "true" if the datalist's selection model allows multiple option elements to be
Expand Down
25 changes: 19 additions & 6 deletions accessibility-checker-engine/src/v2/dom/DOMWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,20 @@ export class DOMWalker {
this.node = elementNode.shadowRoot;
(this.node as any).ownerElement = ownerElement;
DOMWalker.assignSlots(this.node as ShadowRoot);
} else if (this.node.nodeType === 1
} else if (this.node.nodeType === 1
&& elementNode.nodeName.toLowerCase() === "slot"
&& slotElement.assignedNodes().length > 0)
&& slotElement.assignedNodes().length > 0)
{
DBG && console.log("!!!Into slot");
this.node = slotElement.assignedNodes()[0];
} else if ((this.node.nodeType === 1 /* Node.ELEMENT_NODE */ || this.node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */)
} else if (this.node.nodeType === 1
&& elementNode.nodeName.toLowerCase() === "slot"
&& slotElement.assignedNodes().length === 0)
{
DBG && console.log("!!!Empty slot - treat as leaf node, flip to end");
// Empty slot - treat as self-closing leaf node
this.bEndTag = true;
} else if ((this.node.nodeType === 1 /* Node.ELEMENT_NODE */ || this.node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */)
&& DOMWalker.firstChildNotOwnedBySlot(this.node)) {
DBG && console.log("!!!First child");
this.node = DOMWalker.firstChildNotOwnedBySlot(this.node);
Expand Down Expand Up @@ -257,16 +264,22 @@ export class DOMWalker {
let ownerElement = this.node;
this.node = iframeNode.contentDocument.documentElement;
(this.node as any).ownerElement = ownerElement;
} else if (this.node.nodeType === 1 /* Node.ELEMENT_NODE */
} else if (this.node.nodeType === 1 /* Node.ELEMENT_NODE */
&& (this.considerHidden ? VisUtil.isNodeVisible(elementNode) : true)
&& elementNode.shadowRoot
&& elementNode.shadowRoot.lastChild)
&& elementNode.shadowRoot.lastChild)
{
let ownerElement = this.node;
this.node = elementNode.shadowRoot;
(this.node as any).ownerElement = ownerElement;
DOMWalker.assignSlots(this.node as ShadowRoot);
} else if ((this.node.nodeType === 1 /* Node.ELEMENT_NODE */ || this.node.nodeType === 11)
} else if (this.node.nodeType === 1
&& elementNode.nodeName.toLowerCase() === "slot"
&& (elementNode as HTMLSlotElement).assignedNodes().length === 0)
{
// Empty slot - treat as self-closing leaf node
this.bEndTag = false;
} else if ((this.node.nodeType === 1 /* Node.ELEMENT_NODE */ || this.node.nodeType === 11)
&& DOMWalker.lastChildNotOwnedBySlot(this.node)) {
this.node = DOMWalker.lastChildNotOwnedBySlot(this.node);
} else {
Expand Down
121 changes: 0 additions & 121 deletions accessibility-checker-engine/src/v2/dom/NodeWalker.ts

This file was deleted.

Loading