@axe-core/react 4.4.1-alpha.250 → 4.4.2-alpha.255

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.4.1](https://github.com/dequelabs/axe-core-npm/compare/v4.1.1...v4.4.1) (2022-02-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cli,reporter-earl,react:** use correct version of axe-core ([#378](https://github.com/dequelabs/axe-core-npm/issues/378)) ([0c7d050](https://github.com/dequelabs/axe-core-npm/commit/0c7d0506b7d397df3c96414fc37a408e90fe9a9c))
12
+ * **react:** fallback on _reactInternals ([#455](https://github.com/dequelabs/axe-core-npm/issues/455)) ([13f9fd0](https://github.com/dequelabs/axe-core-npm/commit/13f9fd07c24304f0f3dde74d7d41bc8222929c13))
13
+ * update axe-core to 4.2.1 ([#254](https://github.com/dequelabs/axe-core-npm/issues/254)) ([9d90185](https://github.com/dequelabs/axe-core-npm/commit/9d9018525a4d799f6d763d0329f05ccbfd20dbe4))
14
+
15
+
16
+ ### Features
17
+
18
+ * **react:** Add configuration option to optional disable cache (deduplication) ([#309](https://github.com/dequelabs/axe-core-npm/issues/309)) ([435811c](https://github.com/dequelabs/axe-core-npm/commit/435811cb3957cf84b1c1701f6de5c4eb740c8301))
19
+ * **react:** Add support for custom logger ([#181](https://github.com/dequelabs/axe-core-npm/issues/181)) ([1f97433](https://github.com/dequelabs/axe-core-npm/commit/1f974338280460715e7b92d58279c3f18fa563f8))
20
+ * update `axe-core@4.2.2` ([#263](https://github.com/dequelabs/axe-core-npm/issues/263)) ([8c609e1](https://github.com/dequelabs/axe-core-npm/commit/8c609e1e3580a63f8697ca94e146b0e2ed28e579))
21
+ * update axe-core to 4.2.0 ([#240](https://github.com/dequelabs/axe-core-npm/issues/240)) ([4e8f7fe](https://github.com/dequelabs/axe-core-npm/commit/4e8f7fee9db09fb56f91ea34f9984be66a29033e))
22
+ * update to use `axe-core@4.2.3` ([#280](https://github.com/dequelabs/axe-core-npm/issues/280)) ([8aebba5](https://github.com/dequelabs/axe-core-npm/commit/8aebba5c6069ca047f649446e072259c069c9a22))
23
+ * upgrade axe-core to 4.4.1 ([#441](https://github.com/dequelabs/axe-core-npm/issues/441)) ([765c81a](https://github.com/dequelabs/axe-core-npm/commit/765c81a2ae63e8c72ec086b86174a5c5f343ea9b))
24
+
25
+
26
+
27
+
28
+
6
29
  # [4.4.0](https://github.com/dequelabs/axe-core-npm/compare/v4.1.1...v4.4.0) (2022-02-10)
7
30
 
8
31
 
package/dist/index.d.ts CHANGED
@@ -18,4 +18,5 @@ interface ReactSpec extends axeCore.Spec {
18
18
  * @param {Function} _logger Logger implementation
19
19
  */
20
20
  declare function reactAxe(_React: typeof React, _ReactDOM: typeof ReactDOM, _timeout: number, _conf?: ReactSpec, _context?: axeCore.ElementContext, _logger?: (results: axeCore.AxeResults) => void): Promise<void>;
21
- export = reactAxe;
21
+ export declare function _reset(): void;
22
+ export default reactAxe;
package/dist/index.js CHANGED
@@ -10,6 +10,8 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports._reset = void 0;
13
15
  /* global Promise */
14
16
  var axeCore = require("axe-core");
15
17
  var rIC = require("requestidlecallback");
@@ -35,11 +37,11 @@ var theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)
35
37
  ? darkTheme
36
38
  : lightTheme;
37
39
  var boldCourier = 'font-weight:bold;font-family:Courier;';
38
- var critical = "color:" + theme.serious + ";font-weight:bold;";
39
- var serious = "color:" + theme.serious + ";font-weight:normal;";
40
- var moderate = "color:" + theme.minor + ";font-weight:bold;";
41
- var minor = "color:" + theme.minor + ";font-weight:normal;";
42
- var defaultReset = "font-color:" + theme.text + ";font-weight:normal;";
40
+ var critical = "color:".concat(theme.serious, ";font-weight:bold;");
41
+ var serious = "color:".concat(theme.serious, ";font-weight:normal;");
42
+ var moderate = "color:".concat(theme.minor, ";font-weight:bold;");
43
+ var minor = "color:".concat(theme.minor, ";font-weight:normal;");
44
+ var defaultReset = "font-color:".concat(theme.text, ";font-weight:normal;");
43
45
  var idleId;
44
46
  var timeout;
45
47
  var context;
@@ -357,5 +359,14 @@ function reactAxe(_React, _ReactDOM, _timeout, _conf, _context, _logger) {
357
359
  }
358
360
  return checkAndReport(document.body, timeout);
359
361
  }
360
- module.exports = reactAxe;
362
+ // export function just for tests so we can have a clean state
363
+ // between tests
364
+ function _reset() {
365
+ Object.keys(cache).forEach(function (key) {
366
+ delete cache[key];
367
+ });
368
+ axeCore.reset();
369
+ }
370
+ exports._reset = _reset;
371
+ exports.default = reactAxe;
361
372
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oBAAoB;AACpB,kCAAqC;AACrC,yCAA4C;AAC5C,+BAAkC;AAElC,IAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAAC;AACxC,IAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,CAAC;AAEtC,IAAI,KAAK,CAAC;AACV,IAAI,QAAQ,CAAC;AACb,IAAI,MAAM,CAAC;AAEX,qDAAqD;AACrD,IAAM,UAAU,GAAG;IACjB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,uDAAuD;AACvD,IAAM,SAAS,GAAG;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,IAAM,KAAK,GACT,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,8BAA8B,CA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,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAEjD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE;gBAC9C,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;aACxC;iBAAM,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE;gBACrD,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;aACxC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;KACH;IAED,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED,iBAAS,QAAQ,CAAC","sourcesContent":["/* global Promise */\nimport axeCore = require('axe-core');\nimport rIC = require('requestidlecallback');\nimport after = require('./after');\n\nconst requestIdleCallback = rIC.request;\nconst cancelIdleCallback = rIC.cancel;\n\nlet React;\nlet ReactDOM;\nlet logger;\n\n// contrasted against Chrome default color of #ffffff\nconst lightTheme = {\n serious: '#d93251',\n minor: '#d24700',\n text: 'black'\n};\n\n// contrasted against Safari dark mode color of #535353\nconst darkTheme = {\n serious: '#ffb3b3',\n minor: '#ffd500',\n text: 'white'\n};\n\nconst theme =\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n ? darkTheme\n : lightTheme;\n\nconst boldCourier = 'font-weight:bold;font-family:Courier;';\nconst critical = `color:${theme.serious};font-weight:bold;`;\nconst serious = `color:${theme.serious};font-weight:normal;`;\nconst moderate = `color:${theme.minor};font-weight:bold;`;\nconst minor = `color:${theme.minor};font-weight:normal;`;\nconst defaultReset = `font-color:${theme.text};font-weight:normal;`;\n\nlet idleId: number | undefined;\nlet timeout: number;\nlet context: axeCore.ElementContext | undefined;\nlet conf: ReactSpec;\nlet _createElement: typeof React.createElement;\nconst components: { [id: number]: React.Component } = {};\nconst nodes: Node[] = [document.documentElement];\nconst cache: { [key: string]: string } = {};\n\n// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\n// @see https://davidwalsh.name/javascript-debounce-function\nfunction debounce(func: Function, wait: number, immediate?: boolean): Function {\n let _timeout;\n return function (...args): void {\n const later = (): void => {\n _timeout = null;\n if (!immediate) func.apply(this, args);\n };\n const callNow = immediate && !_timeout;\n clearTimeout(_timeout);\n _timeout = setTimeout(later, wait);\n if (callNow) func.apply(this, args);\n };\n}\n\n/**\n * Return the entire parent tree of a node (from HTML down).\n * @param {Node} node\n * @return {Node[]}\n */\nfunction getPath(node: Node): Node[] {\n const path: Node[] = [node];\n while (node && node.nodeName.toLowerCase() !== 'html') {\n path.push(node.parentNode);\n node = node.parentNode;\n }\n if (!node || !node.parentNode) {\n return null;\n }\n return path.reverse();\n}\n\n/**\n * Find the common parent of an array of nodes.\n * @param {Node[]} nodes\n * @return {Node}\n */\nfunction getCommonParent(nodes: Node[]): Node {\n let path: Node[] | null;\n let nextPath: Node[] | null;\n if (nodes.length === 1) {\n return nodes.pop();\n }\n while (!path && nodes.length) {\n path = getPath(nodes.pop());\n }\n while (nodes.length) {\n nextPath = getPath(nodes.pop());\n if (nextPath) {\n path = path.filter((node: Node, index: number) => {\n return nextPath.length > index && nextPath[index] === node;\n });\n }\n }\n return path ? path[path.length - 1] : document;\n}\n\n/**\n * Log the axe result node to the console\n * @param {NodeResult} node\n * @param {Function} logFn console log function to use (error, warn, log, etc.)\n */\nfunction logElement(\n node: axeCore.NodeResult | axeCore.RelatedNode,\n logFn: (...args) => void\n): void {\n const el = document.querySelector(node.target.toString());\n if (!el) {\n logFn('Selector: %c%s', boldCourier, node.target.toString());\n } else {\n logFn('Element: %o', el);\n }\n}\n\n/**\n * Log the axe result node html tot he console\n * @param {NodeResult} node\n */\nfunction logHtml(node: axeCore.NodeResult | axeCore.RelatedNode): void {\n console.log('HTML: %c%s', boldCourier, node.html);\n}\n\n/**\n * Log the failure message of a node result.\n * @param {NodeResult} node\n * @param {String} key which check array to log from (any, all, none)\n */\nfunction logFailureMessage(\n node: axeCore.NodeResult,\n key: AxeCoreNodeResultKey\n): void {\n // this exists on axe but we don't export it as part of the typescript\n // namespace, so just let me use it as I need\n const message: string = (\n axeCore as unknown as AxeWithAudit\n )._audit.data.failureSummaries[key].failureMessage(\n node[key].map(check => check.message || '')\n );\n\n console.error(message);\n}\n\n/**\n * Log as a group the node result and failure message.\n * @param {NodeResult} node\n * @param {String} key which check array to log from (any, all, none)\n */\nfunction failureSummary(\n node: axeCore.NodeResult,\n key: AxeCoreNodeResultKey\n): void {\n if (node[key].length > 0) {\n logElement(node, console.groupCollapsed);\n logHtml(node);\n logFailureMessage(node, key);\n\n let relatedNodes: axeCore.RelatedNode[] = [];\n node[key].forEach(check => {\n relatedNodes = relatedNodes.concat(check.relatedNodes);\n });\n\n if (relatedNodes.length > 0) {\n console.groupCollapsed('Related nodes');\n relatedNodes.forEach(relatedNode => {\n logElement(relatedNode, console.log);\n logHtml(relatedNode);\n });\n console.groupEnd();\n }\n\n console.groupEnd();\n }\n}\n\n/**\n * Run axe against the passed in node and report violations\n * @param {*} node\n * @param {Number} timeout force call of axe.run after the timeout has passed (if not called before)\n * @return {Promise}\n */\nfunction checkAndReport(node: Node, timeout: number): Promise<void> {\n const disableDeduplicate = conf['disableDeduplicate'];\n\n if (idleId) {\n cancelIdleCallback(idleId);\n idleId = undefined;\n }\n\n return new Promise((resolve, reject) => {\n nodes.push(node);\n idleId = requestIdleCallback(\n () => {\n let n: axeCore.ElementContext | Node = context;\n if (n === undefined) {\n n = getCommonParent(nodes.filter(node => node.isConnected));\n if (n.nodeName.toLowerCase() === 'html') {\n // if the only common parent is the body, then analyze the whole page\n n = document;\n }\n }\n axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\n axeCore.run(\n n,\n { reporter: 'v2' },\n function (error: Error, results: axeCore.AxeResults) {\n if (error) {\n return reject(error);\n }\n\n results.violations = results.violations.filter(result => {\n result.nodes = result.nodes.filter(node => {\n const key: string = node.target.toString() + result.id;\n const retVal = !cache[key];\n cache[key] = key;\n return disableDeduplicate || retVal;\n });\n return !!result.nodes.length;\n });\n\n if (results.violations.length) {\n logger(results);\n }\n\n resolve();\n }\n );\n },\n {\n timeout: timeout\n }\n );\n });\n}\n\n/**\n * Check the node for violations.\n * @param {Component} component\n */\nfunction checkNode(component: React.Component): void {\n let node: Node;\n\n try {\n node = ReactDOM.findDOMNode(component);\n } catch (e) {\n console.group('%caxe error: could not check node', critical);\n console.group('%cComponent', serious);\n console.error(component);\n console.groupEnd();\n console.group('%cError', serious);\n console.error(e);\n console.groupEnd();\n console.groupEnd();\n }\n\n if (node) {\n checkAndReport(node, timeout);\n }\n}\n\n/**\n * Check the component for violations whenever the DOM updates\n * @param {Component} component\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction componentAfterRender(component: any): void {\n const debounceCheckNode: Function = debounce(checkNode, timeout, true);\n after(component, 'componentDidMount', debounceCheckNode);\n after(component, 'componentDidUpdate', debounceCheckNode);\n}\n\n/**\n * Add a component to track.\n * @param {Component} component\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction addComponent(component: any): void {\n const reactInstance = component._reactInternalInstance || {};\n const reactInstanceDebugID = reactInstance._debugID;\n const reactFiberInstance = component._reactInternalFiber || {};\n const reactFiberInstanceDebugID = reactFiberInstance._debugID;\n const reactInternals = component._reactInternals || {};\n const reactInternalsDebugID = reactInternals._debugID;\n\n if (reactInstanceDebugID && !components[reactInstanceDebugID]) {\n components[reactInstanceDebugID] = component;\n componentAfterRender(component);\n } else if (\n reactFiberInstanceDebugID &&\n !components[reactFiberInstanceDebugID]\n ) {\n components[reactFiberInstanceDebugID] = component;\n componentAfterRender(component);\n } else if (reactInternalsDebugID && !components[reactInternalsDebugID]) {\n components[reactInternalsDebugID] = component;\n componentAfterRender(component);\n }\n}\n\n/**\n * Log axe violations to console.\n * @param {AxeResults} results\n */\nfunction logToConsole(results: axeCore.AxeResults): void {\n console.group('%cNew axe issues', serious);\n results.violations.forEach(result => {\n let fmt: string;\n switch (result.impact) {\n case 'critical':\n fmt = critical;\n break;\n case 'serious':\n fmt = serious;\n break;\n case 'moderate':\n fmt = moderate;\n break;\n case 'minor':\n fmt = minor;\n break;\n default:\n fmt = minor;\n break;\n }\n console.groupCollapsed(\n '%c%s: %c%s %s',\n fmt,\n result.impact,\n defaultReset,\n result.help,\n result.helpUrl\n );\n result.nodes.forEach(node => {\n failureSummary(node, 'any');\n failureSummary(node, 'none');\n });\n console.groupEnd();\n });\n console.groupEnd();\n}\n\n/**\n * To support paramater of type runOnly\n */\ninterface ReactSpec extends axeCore.Spec {\n runOnly?: string[];\n disableDeduplicate?: boolean;\n}\n\n/**\n * Run axe against all changes made in a React app.\n * @parma {React} _React React instance\n * @param {ReactDOM} _ReactDOM ReactDOM instance\n * @param {Number} _timeout debounce timeout in milliseconds\n * @parma {Spec} conf React axe.configure Spec object\n * @param {ElementContext} _context axe ElementContent object\n * @param {Function} _logger Logger implementation\n */\nfunction reactAxe(\n _React: typeof React,\n _ReactDOM: typeof ReactDOM,\n _timeout: number,\n _conf = {} as ReactSpec,\n _context?: axeCore.ElementContext,\n _logger?: (results: axeCore.AxeResults) => void\n): Promise<void> {\n React = _React;\n ReactDOM = _ReactDOM;\n timeout = _timeout;\n context = _context;\n conf = _conf;\n logger = _logger || logToConsole;\n\n const runOnly = conf['runOnly'];\n if (runOnly) {\n conf['rules'] = axeCore\n .getRules(runOnly)\n .map(rule => ({ ...rule, id: rule.ruleId, enabled: true }));\n conf['disableOtherRules'] = true;\n }\n\n if (Object.keys(conf).length > 0) {\n axeCore.configure(conf);\n }\n axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\n if (!_createElement) {\n _createElement = React.createElement;\n\n React.createElement = function (...args): React.Component {\n const reactEl = _createElement.apply(this, args);\n\n if (reactEl._owner && reactEl._owner._instance) {\n addComponent(reactEl._owner._instance);\n } else if (reactEl._owner && reactEl._owner.stateNode) {\n addComponent(reactEl._owner.stateNode);\n }\n\n return reactEl;\n };\n }\n\n return checkAndReport(document.body, timeout);\n}\n\nexport = reactAxe;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oBAAoB;AACpB,kCAAqC;AACrC,yCAA4C;AAC5C,+BAAkC;AAElC,IAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAAC;AACxC,IAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,CAAC;AAEtC,IAAI,KAAK,CAAC;AACV,IAAI,QAAQ,CAAC;AACb,IAAI,MAAM,CAAC;AAEX,qDAAqD;AACrD,IAAM,UAAU,GAAG;IACjB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,uDAAuD;AACvD,IAAM,SAAS,GAAG;IAChB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,IAAM,KAAK,GACT,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO;IAC5E,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,UAAU,CAAC;AAEjB,IAAM,WAAW,GAAG,uCAAuC,CAAC;AAC5D,IAAM,QAAQ,GAAG,gBAAS,KAAK,CAAC,OAAO,uBAAoB,CAAC;AAC5D,IAAM,OAAO,GAAG,gBAAS,KAAK,CAAC,OAAO,yBAAsB,CAAC;AAC7D,IAAM,QAAQ,GAAG,gBAAS,KAAK,CAAC,KAAK,uBAAoB,CAAC;AAC1D,IAAM,KAAK,GAAG,gBAAS,KAAK,CAAC,KAAK,yBAAsB,CAAC;AACzD,IAAM,YAAY,GAAG,qBAAc,KAAK,CAAC,IAAI,yBAAsB,CAAC;AAEpE,IAAI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;AAChD,CAAC;AAED,8DAA8D;AAC9D,gBAAgB;AAChB,SAAgB,MAAM;IACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;QAC5B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAND,wBAMC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["/* global Promise */\nimport axeCore = require('axe-core');\nimport rIC = require('requestidlecallback');\nimport after = require('./after');\n\nconst requestIdleCallback = rIC.request;\nconst cancelIdleCallback = rIC.cancel;\n\nlet React;\nlet ReactDOM;\nlet logger;\n\n// contrasted against Chrome default color of #ffffff\nconst lightTheme = {\n serious: '#d93251',\n minor: '#d24700',\n text: 'black'\n};\n\n// contrasted against Safari dark mode color of #535353\nconst darkTheme = {\n serious: '#ffb3b3',\n minor: '#ffd500',\n text: 'white'\n};\n\nconst theme =\n window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n ? darkTheme\n : lightTheme;\n\nconst boldCourier = 'font-weight:bold;font-family:Courier;';\nconst critical = `color:${theme.serious};font-weight:bold;`;\nconst serious = `color:${theme.serious};font-weight:normal;`;\nconst moderate = `color:${theme.minor};font-weight:bold;`;\nconst minor = `color:${theme.minor};font-weight:normal;`;\nconst defaultReset = `font-color:${theme.text};font-weight:normal;`;\n\nlet idleId: number | undefined;\nlet timeout: number;\nlet context: axeCore.ElementContext | undefined;\nlet conf: ReactSpec;\nlet _createElement: typeof React.createElement;\nconst components: { [id: number]: React.Component } = {};\nconst nodes: Node[] = [document.documentElement];\nconst cache: { [key: string]: string } = {};\n\n// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\n// @see https://davidwalsh.name/javascript-debounce-function\nfunction debounce(func: Function, wait: number, immediate?: boolean): Function {\n let _timeout;\n return function (...args): void {\n const later = (): void => {\n _timeout = null;\n if (!immediate) func.apply(this, args);\n };\n const callNow = immediate && !_timeout;\n clearTimeout(_timeout);\n _timeout = setTimeout(later, wait);\n if (callNow) func.apply(this, args);\n };\n}\n\n/**\n * Return the entire parent tree of a node (from HTML down).\n * @param {Node} node\n * @return {Node[]}\n */\nfunction getPath(node: Node): Node[] {\n const path: Node[] = [node];\n while (node && node.nodeName.toLowerCase() !== 'html') {\n path.push(node.parentNode);\n node = node.parentNode;\n }\n if (!node || !node.parentNode) {\n return null;\n }\n return path.reverse();\n}\n\n/**\n * Find the common parent of an array of nodes.\n * @param {Node[]} nodes\n * @return {Node}\n */\nfunction getCommonParent(nodes: Node[]): Node {\n let path: Node[] | null;\n let nextPath: Node[] | null;\n if (nodes.length === 1) {\n return nodes.pop();\n }\n while (!path && nodes.length) {\n path = getPath(nodes.pop());\n }\n while (nodes.length) {\n nextPath = getPath(nodes.pop());\n if (nextPath) {\n path = path.filter((node: Node, index: number) => {\n return nextPath.length > index && nextPath[index] === node;\n });\n }\n }\n return path ? path[path.length - 1] : document;\n}\n\n/**\n * Log the axe result node to the console\n * @param {NodeResult} node\n * @param {Function} logFn console log function to use (error, warn, log, etc.)\n */\nfunction logElement(\n node: axeCore.NodeResult | axeCore.RelatedNode,\n logFn: (...args) => void\n): void {\n const el = document.querySelector(node.target.toString());\n if (!el) {\n logFn('Selector: %c%s', boldCourier, node.target.toString());\n } else {\n logFn('Element: %o', el);\n }\n}\n\n/**\n * Log the axe result node html tot he console\n * @param {NodeResult} node\n */\nfunction logHtml(node: axeCore.NodeResult | axeCore.RelatedNode): void {\n console.log('HTML: %c%s', boldCourier, node.html);\n}\n\n/**\n * Log the failure message of a node result.\n * @param {NodeResult} node\n * @param {String} key which check array to log from (any, all, none)\n */\nfunction logFailureMessage(\n node: axeCore.NodeResult,\n key: AxeCoreNodeResultKey\n): void {\n // this exists on axe but we don't export it as part of the typescript\n // namespace, so just let me use it as I need\n const message: string = (\n axeCore as unknown as AxeWithAudit\n )._audit.data.failureSummaries[key].failureMessage(\n node[key].map(check => check.message || '')\n );\n\n console.error(message);\n}\n\n/**\n * Log as a group the node result and failure message.\n * @param {NodeResult} node\n * @param {String} key which check array to log from (any, all, none)\n */\nfunction failureSummary(\n node: axeCore.NodeResult,\n key: AxeCoreNodeResultKey\n): void {\n if (node[key].length > 0) {\n logElement(node, console.groupCollapsed);\n logHtml(node);\n logFailureMessage(node, key);\n\n let relatedNodes: axeCore.RelatedNode[] = [];\n node[key].forEach(check => {\n relatedNodes = relatedNodes.concat(check.relatedNodes);\n });\n\n if (relatedNodes.length > 0) {\n console.groupCollapsed('Related nodes');\n relatedNodes.forEach(relatedNode => {\n logElement(relatedNode, console.log);\n logHtml(relatedNode);\n });\n console.groupEnd();\n }\n\n console.groupEnd();\n }\n}\n\n/**\n * Run axe against the passed in node and report violations\n * @param {*} node\n * @param {Number} timeout force call of axe.run after the timeout has passed (if not called before)\n * @return {Promise}\n */\nfunction checkAndReport(node: Node, timeout: number): Promise<void> {\n const disableDeduplicate = conf['disableDeduplicate'];\n\n if (idleId) {\n cancelIdleCallback(idleId);\n idleId = undefined;\n }\n\n return new Promise((resolve, reject) => {\n nodes.push(node);\n idleId = requestIdleCallback(\n () => {\n let n: axeCore.ElementContext | Node = context;\n if (n === undefined) {\n n = getCommonParent(nodes.filter(node => node.isConnected));\n if (n.nodeName.toLowerCase() === 'html') {\n // if the only common parent is the body, then analyze the whole page\n n = document;\n }\n }\n axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\n axeCore.run(\n n,\n { reporter: 'v2' },\n function (error: Error, results: axeCore.AxeResults) {\n if (error) {\n return reject(error);\n }\n\n results.violations = results.violations.filter(result => {\n result.nodes = result.nodes.filter(node => {\n const key: string = node.target.toString() + result.id;\n const retVal = !cache[key];\n cache[key] = key;\n return disableDeduplicate || retVal;\n });\n return !!result.nodes.length;\n });\n\n if (results.violations.length) {\n logger(results);\n }\n\n resolve();\n }\n );\n },\n {\n timeout: timeout\n }\n );\n });\n}\n\n/**\n * Check the node for violations.\n * @param {Component} component\n */\nfunction checkNode(component: React.Component): void {\n let node: Node;\n\n try {\n node = ReactDOM.findDOMNode(component);\n } catch (e) {\n console.group('%caxe error: could not check node', critical);\n console.group('%cComponent', serious);\n console.error(component);\n console.groupEnd();\n console.group('%cError', serious);\n console.error(e);\n console.groupEnd();\n console.groupEnd();\n }\n\n if (node) {\n checkAndReport(node, timeout);\n }\n}\n\n/**\n * Check the component for violations whenever the DOM updates\n * @param {Component} component\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction componentAfterRender(component: any): void {\n const debounceCheckNode: Function = debounce(checkNode, timeout, true);\n after(component, 'componentDidMount', debounceCheckNode);\n after(component, 'componentDidUpdate', debounceCheckNode);\n}\n\n/**\n * Add a component to track.\n * @param {Component} component\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction addComponent(component: any): void {\n const reactInstance = component._reactInternalInstance || {};\n const reactInstanceDebugID = reactInstance._debugID;\n const reactFiberInstance = component._reactInternalFiber || {};\n const reactFiberInstanceDebugID = reactFiberInstance._debugID;\n const reactInternals = component._reactInternals || {};\n const reactInternalsDebugID = reactInternals._debugID;\n\n if (reactInstanceDebugID && !components[reactInstanceDebugID]) {\n components[reactInstanceDebugID] = component;\n componentAfterRender(component);\n } else if (\n reactFiberInstanceDebugID &&\n !components[reactFiberInstanceDebugID]\n ) {\n components[reactFiberInstanceDebugID] = component;\n componentAfterRender(component);\n } else if (reactInternalsDebugID && !components[reactInternalsDebugID]) {\n components[reactInternalsDebugID] = component;\n componentAfterRender(component);\n }\n}\n\n/**\n * Log axe violations to console.\n * @param {AxeResults} results\n */\nfunction logToConsole(results: axeCore.AxeResults): void {\n console.group('%cNew axe issues', serious);\n results.violations.forEach(result => {\n let fmt: string;\n switch (result.impact) {\n case 'critical':\n fmt = critical;\n break;\n case 'serious':\n fmt = serious;\n break;\n case 'moderate':\n fmt = moderate;\n break;\n case 'minor':\n fmt = minor;\n break;\n default:\n fmt = minor;\n break;\n }\n console.groupCollapsed(\n '%c%s: %c%s %s',\n fmt,\n result.impact,\n defaultReset,\n result.help,\n result.helpUrl\n );\n result.nodes.forEach(node => {\n failureSummary(node, 'any');\n failureSummary(node, 'none');\n });\n console.groupEnd();\n });\n console.groupEnd();\n}\n\n/**\n * To support paramater of type runOnly\n */\ninterface ReactSpec extends axeCore.Spec {\n runOnly?: string[];\n disableDeduplicate?: boolean;\n}\n\n/**\n * Run axe against all changes made in a React app.\n * @parma {React} _React React instance\n * @param {ReactDOM} _ReactDOM ReactDOM instance\n * @param {Number} _timeout debounce timeout in milliseconds\n * @parma {Spec} conf React axe.configure Spec object\n * @param {ElementContext} _context axe ElementContent object\n * @param {Function} _logger Logger implementation\n */\nfunction reactAxe(\n _React: typeof React,\n _ReactDOM: typeof ReactDOM,\n _timeout: number,\n _conf = {} as ReactSpec,\n _context?: axeCore.ElementContext,\n _logger?: (results: axeCore.AxeResults) => void\n): Promise<void> {\n React = _React;\n ReactDOM = _ReactDOM;\n timeout = _timeout;\n context = _context;\n conf = _conf;\n logger = _logger || logToConsole;\n\n const runOnly = conf['runOnly'];\n if (runOnly) {\n conf['rules'] = axeCore\n .getRules(runOnly)\n .map(rule => ({ ...rule, id: rule.ruleId, enabled: true }));\n conf['disableOtherRules'] = true;\n }\n\n if (Object.keys(conf).length > 0) {\n axeCore.configure(conf);\n }\n axeCore.configure({ allowedOrigins: ['<unsafe_all_origins>'] });\n if (!_createElement) {\n _createElement = React.createElement;\n\n React.createElement = function (...args): React.Component {\n const reactEl = _createElement.apply(this, args);\n\n if (reactEl._owner && reactEl._owner._instance) {\n addComponent(reactEl._owner._instance);\n } else if (reactEl._owner && reactEl._owner.stateNode) {\n addComponent(reactEl._owner.stateNode);\n }\n\n return reactEl;\n };\n }\n\n return checkAndReport(document.body, timeout);\n}\n\n// export function just for tests so we can have a clean state\n// between tests\nexport function _reset() {\n Object.keys(cache).forEach(key => {\n delete cache[key];\n });\n\n axeCore.reset();\n}\n\nexport default reactAxe;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axe-core/react",
3
- "version": "4.4.1-alpha.250+ff9f0dd",
3
+ "version": "4.4.2-alpha.255+49a3b32",
4
4
  "description": "Dynamic accessibility analysis for React using axe-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,8 @@
15
15
  "scripts": {
16
16
  "build": "tsc",
17
17
  "prepare": "npm run build",
18
- "test": "tsc && npm run test:types && npm run test:cypress",
19
- "test:types": "cd test && tsc",
20
- "test:cypress": "start-server-and-test start-server http://localhost:8080 test:run",
21
- "start-server": "cd examples/shadow-dom && npm run start",
22
- "test:run": "cypress run",
23
- "test:debug": "cypress open"
18
+ "test": "tsc && npm run test:types && jest",
19
+ "test:types": "cd test && tsc"
24
20
  },
25
21
  "keywords": [
26
22
  "accessibility",
@@ -52,15 +48,22 @@
52
48
  "requestidlecallback": "^0.3.0"
53
49
  },
54
50
  "devDependencies": {
51
+ "@babel/core": "^7.17.3",
52
+ "@babel/preset-env": "^7.16.11",
53
+ "@babel/preset-react": "^7.16.7",
54
+ "@babel/preset-typescript": "^7.16.7",
55
55
  "@types/react": "^17.0.33",
56
56
  "@types/react-dom": "^17.0.10",
57
57
  "@types/requestidlecallback": "^0.3.4",
58
- "cypress": "^8.7.0",
59
- "cypress-shadow-dom": "^1.3.0",
58
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
59
+ "chai": "^4.3.6",
60
+ "enzyme": "^3.11.0",
60
61
  "http-server": "^14.0.0",
62
+ "jest": "^27.5.1",
61
63
  "react": "^17.0.2",
62
64
  "react-dom": "^17.0.2",
63
- "start-server-and-test": "^1.14.0",
65
+ "react-shadow": "^19.0.2",
66
+ "sinon": "^13.0.1",
64
67
  "ts-node": "^10.4.0",
65
68
  "typescript": "^4.4.4"
66
69
  },
@@ -68,5 +71,11 @@
68
71
  "type": "git",
69
72
  "url": "https://github.com/dequelabs/axe-core-npm.git"
70
73
  },
71
- "gitHead": "ff9f0dd6925597deb839a95fe5925e7a01956a41"
74
+ "jest": {
75
+ "testEnvironment": "jsdom",
76
+ "setupFilesAfterEnv": [
77
+ "<rootDir>/test/jest.setup.js"
78
+ ]
79
+ },
80
+ "gitHead": "49a3b3218a109146817c1e740817db21c7e6f66b"
72
81
  }