diff --git a/lib/checks/aria/required-children.js b/lib/checks/aria/required-children.js
index 0d8b253607..0ae3aada6a 100644
--- a/lib/checks/aria/required-children.js
+++ b/lib/checks/aria/required-children.js
@@ -30,7 +30,7 @@ function ariaOwns(nodes, role) {
if (nodes[index] === null) {
continue;
}
- let virtualTree = axe.utils.getNodeFromTree(axe._tree[0], nodes[index]);
+ const virtualTree = axe.utils.getNodeFromTree(nodes[index]);
if (owns(nodes[index], virtualTree, role, true)) {
return true;
}
diff --git a/lib/checks/aria/required-parent.js b/lib/checks/aria/required-parent.js
index 45d1a646c7..21aa9ea14f 100644
--- a/lib/checks/aria/required-parent.js
+++ b/lib/checks/aria/required-parent.js
@@ -73,7 +73,7 @@ var owners = getAriaOwners(node);
if (owners) {
for (var i = 0, l = owners.length; i < l; i++) {
missingParents = getMissingContext(
- axe.utils.getNodeFromTree(axe._tree[0], owners[i]),
+ axe.utils.getNodeFromTree(owners[i]),
missingParents,
true
);
diff --git a/lib/commons/aria/get-owned-virtual.js b/lib/commons/aria/get-owned-virtual.js
index ec904786ce..0fc9e3391f 100644
--- a/lib/commons/aria/get-owned-virtual.js
+++ b/lib/commons/aria/get-owned-virtual.js
@@ -16,7 +16,7 @@ aria.getOwnedVirtual = function getOwned({ actualNode, children }) {
return dom.idrefs(actualNode, 'aria-owns').reduce((ownedElms, element) => {
if (element) {
- const virtualNode = axe.utils.getNodeFromTree(axe._tree[0], element);
+ const virtualNode = axe.utils.getNodeFromTree(element);
ownedElms.push(virtualNode);
}
return ownedElms;
diff --git a/lib/commons/aria/is-accessible-ref.js b/lib/commons/aria/is-accessible-ref.js
index ed7e842648..0278a1571e 100644
--- a/lib/commons/aria/is-accessible-ref.js
+++ b/lib/commons/aria/is-accessible-ref.js
@@ -1,13 +1,24 @@
/* global aria, axe, dom */
-function findDomNode(node, functor) {
- if (functor(node)) {
- return node;
+const idRefsRegex = /^idrefs?$/;
+
+function cacheIdRefs(node, refAttrs) {
+ if (node.hasAttribute) {
+ if (node.nodeName.toUpperCase() === 'LABEL' && node.hasAttribute('for')) {
+ axe._cache.idRefs[node.getAttribute('for')] = true;
+ }
+
+ refAttrs
+ .filter(attr => node.hasAttribute(attr))
+ .forEach(attr => {
+ const attrValue = node.getAttribute(attr);
+ axe.utils.tokenList(attrValue).forEach(id => {
+ axe._cache.idRefs[id] = true;
+ });
+ });
}
+
for (let i = 0; i < node.children.length; i++) {
- const out = findDomNode(node.children[i], functor);
- if (out) {
- return out;
- }
+ cacheIdRefs(node.children[i], refAttrs);
}
}
@@ -22,34 +33,18 @@ aria.isAccessibleRef = function isAccessibleRef(node) {
root = root.documentElement || root; // account for shadow roots
const id = node.id;
- // Get all idref(s) attributes on the lookup table
- const refAttrs = Object.keys(aria.lookupTable.attributes).filter(attr => {
- const { type } = aria.lookupTable.attributes[attr];
- return /^idrefs?$/.test(type);
- });
+ // because axe.commons is not available in axe.utils, we can't do
+ // this caching when we build up the virtual tree
+ if (!axe._cache.idRefs) {
+ axe._cache.idRefs = {};
+ // Get all idref(s) attributes on the lookup table
+ const refAttrs = Object.keys(aria.lookupTable.attributes).filter(attr => {
+ const { type } = aria.lookupTable.attributes[attr];
+ return idRefsRegex.test(type);
+ });
- // Find the first element that IDREF(S) the node
- let refElm = findDomNode(root, elm => {
- if (elm.nodeType !== 1) {
- // Elements only
- return;
- }
- if (
- elm.nodeName.toUpperCase() === 'LABEL' &&
- elm.getAttribute('for') === id
- ) {
- return true;
- }
- // See if there are any aria attributes that reference the node
- return refAttrs
- .filter(attr => elm.hasAttribute(attr))
- .some(attr => {
- const attrValue = elm.getAttribute(attr);
- if (aria.lookupTable.attributes[attr].type === 'idref') {
- return attrValue === id;
- }
- return axe.utils.tokenList(attrValue).includes(id);
- });
- });
- return typeof refElm !== 'undefined';
+ cacheIdRefs(root, refAttrs);
+ }
+
+ return axe._cache.idRefs[id] === true;
};
diff --git a/lib/commons/aria/label-virtual.js b/lib/commons/aria/label-virtual.js
index 2014254dba..97eb2eb5fb 100644
--- a/lib/commons/aria/label-virtual.js
+++ b/lib/commons/aria/label-virtual.js
@@ -17,7 +17,7 @@ aria.labelVirtual = function({ actualNode }) {
ref = dom.idrefs(actualNode, 'aria-labelledby');
candidate = ref
.map(function(thing) {
- const vNode = axe.utils.getNodeFromTree(axe._tree[0], thing);
+ const vNode = axe.utils.getNodeFromTree(thing);
return vNode ? text.visibleVirtual(vNode, true) : '';
})
.join(' ')
@@ -49,6 +49,6 @@ aria.labelVirtual = function({ actualNode }) {
* @return {Mixed} String of visible text, or `null` if no label is found
*/
aria.label = function(node) {
- node = axe.utils.getNodeFromTree(axe._tree[0], node);
+ node = axe.utils.getNodeFromTree(node);
return aria.labelVirtual(node);
};
diff --git a/lib/commons/dom/find-up.js b/lib/commons/dom/find-up.js
index 4699a0c8cb..da02d5c5e0 100644
--- a/lib/commons/dom/find-up.js
+++ b/lib/commons/dom/find-up.js
@@ -11,10 +11,7 @@
* @return {HTMLElement|null} Either the matching HTMLElement or `null` if there was no match
*/
dom.findUp = function(element, target) {
- return dom.findUpVirtual(
- axe.utils.getNodeFromTree(axe._tree[0], element),
- target
- );
+ return dom.findUpVirtual(axe.utils.getNodeFromTree(element), target);
};
/**
diff --git a/lib/commons/dom/has-content-virtual.js b/lib/commons/dom/has-content-virtual.js
index 450e25b12e..9b07d1e4b8 100644
--- a/lib/commons/dom/has-content-virtual.js
+++ b/lib/commons/dom/has-content-virtual.js
@@ -59,7 +59,7 @@ dom.hasContentVirtual = function(elm, noRecursion) {
* @return {Boolean}
*/
dom.hasContent = function hasContent(elm, noRecursion) {
- elm = axe.utils.getNodeFromTree(axe._tree[0], elm);
+ elm = axe.utils.getNodeFromTree(elm);
return dom.hasContentVirtual(elm, noRecursion);
};
diff --git a/lib/commons/dom/is-in-text-block.js b/lib/commons/dom/is-in-text-block.js
index d3b33d7b15..8968b8de77 100644
--- a/lib/commons/dom/is-in-text-block.js
+++ b/lib/commons/dom/is-in-text-block.js
@@ -17,7 +17,7 @@ function getBlockParent(node) {
while (parentBlock && !isBlock(parentBlock)) {
parentBlock = dom.getComposedParent(parentBlock);
}
- return axe.utils.getNodeFromTree(axe._tree[0], parentBlock);
+ return axe.utils.getNodeFromTree(parentBlock);
}
/**
diff --git a/lib/commons/dom/is-visible.js b/lib/commons/dom/is-visible.js
index 4f4d4663ce..ee15196e41 100644
--- a/lib/commons/dom/is-visible.js
+++ b/lib/commons/dom/is-visible.js
@@ -33,7 +33,8 @@ function isClipped(clip) {
*/
dom.isVisible = function(el, screenReader, recursed) {
'use strict';
- var style, nodeName, parent;
+ const node = axe.utils.getNodeFromTree(el);
+ const cacheName = '_isVisible' + (screenReader ? 'ScreenReader' : '');
// 9 === Node.DOCUMENT
if (el.nodeType === 9) {
@@ -45,12 +46,16 @@ dom.isVisible = function(el, screenReader, recursed) {
el = el.host; // grab the host Node
}
- style = window.getComputedStyle(el, null);
+ if (node && typeof node[cacheName] !== 'undefined') {
+ return node[cacheName];
+ }
+
+ const style = window.getComputedStyle(el, null);
if (style === null) {
return false;
}
- nodeName = el.nodeName.toUpperCase();
+ const nodeName = el.nodeName.toUpperCase();
if (
style.getPropertyValue('display') === 'none' ||
@@ -66,10 +71,15 @@ dom.isVisible = function(el, screenReader, recursed) {
return false;
}
- parent = el.assignedSlot ? el.assignedSlot : el.parentNode;
+ const parent = el.assignedSlot ? el.assignedSlot : el.parentNode;
+ let isVisible = false;
if (parent) {
- return dom.isVisible(parent, screenReader, true);
+ isVisible = dom.isVisible(parent, screenReader, true);
}
- return false;
+ if (node) {
+ node[cacheName] = isVisible;
+ }
+
+ return isVisible;
};
diff --git a/lib/commons/text/accessible-text-virtual.js b/lib/commons/text/accessible-text-virtual.js
index 446efdd7a6..99091b4fa3 100644
--- a/lib/commons/text/accessible-text-virtual.js
+++ b/lib/commons/text/accessible-text-virtual.js
@@ -11,7 +11,7 @@
* @return {string}
*/
text.accessibleText = function accessibleText(element, context) {
- let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], element); // throws an exception on purpose if axe._tree not correct
+ const virtualNode = axe.utils.getNodeFromTree(element); // throws an exception on purpose if axe._tree not correct
return text.accessibleTextVirtual(virtualNode, context);
};
diff --git a/lib/commons/text/label-virtual.js b/lib/commons/text/label-virtual.js
index 10a5b5f9fb..87319f569c 100644
--- a/lib/commons/text/label-virtual.js
+++ b/lib/commons/text/label-virtual.js
@@ -48,6 +48,6 @@ text.labelVirtual = function(node) {
* @return {Mixed} String of visible text, or `null` if no label is found
*/
text.label = function(node) {
- node = axe.utils.getNodeFromTree(axe._tree[0], node);
+ node = axe.utils.getNodeFromTree(node);
return text.labelVirtual(node);
};
diff --git a/lib/commons/text/visible-virtual.js b/lib/commons/text/visible-virtual.js
index f591d32c6f..5c62337d8b 100644
--- a/lib/commons/text/visible-virtual.js
+++ b/lib/commons/text/visible-virtual.js
@@ -41,6 +41,6 @@ text.visibleVirtual = function(element, screenReader, noRecursing) {
* @return {String}
*/
text.visible = function(element, screenReader, noRecursing) {
- element = axe.utils.getNodeFromTree(axe._tree[0], element);
+ element = axe.utils.getNodeFromTree(element);
return text.visibleVirtual(element, screenReader, noRecursing);
};
diff --git a/lib/core/base/context.js b/lib/core/base/context.js
index c7a5753c5a..3d05dcd939 100644
--- a/lib/core/base/context.js
+++ b/lib/core/base/context.js
@@ -134,7 +134,7 @@ function parseSelectorArray(context, type) {
//eslint no-loop-func:0
result = result.concat(
nodeList.map(node => {
- return axe.utils.getNodeFromTree(context.flatTree[0], node);
+ return axe.utils.getNodeFromTree(node);
})
);
break;
@@ -146,7 +146,7 @@ function parseSelectorArray(context, type) {
//eslint no-loop-func:0
result = result.concat(
nodeList.map(node => {
- return axe.utils.getNodeFromTree(context.flatTree[0], node);
+ return axe.utils.getNodeFromTree(node);
})
);
}
@@ -154,7 +154,7 @@ function parseSelectorArray(context, type) {
if (item.documentElement instanceof Node) {
result.push(context.flatTree[0]);
} else {
- result.push(axe.utils.getNodeFromTree(context.flatTree[0], item));
+ result.push(axe.utils.getNodeFromTree(item));
}
}
}
diff --git a/lib/core/imports/index.js b/lib/core/imports/index.js
index 9b81dbf878..b49e962827 100644
--- a/lib/core/imports/index.js
+++ b/lib/core/imports/index.js
@@ -14,6 +14,12 @@ if (!('Promise' in window)) {
require('es6-promise').polyfill();
}
+/**
+ * Polyfill `WeakMap`
+ * Reference: https://github.com/polygonplanet/weakmap-polyfill
+ */
+require('weakmap-polyfill');
+
/**
* Namespace `axe.imports` which holds required external dependencies
*
diff --git a/lib/core/public/run-rules.js b/lib/core/public/run-rules.js
index 173b8aaaef..d740531371 100644
--- a/lib/core/public/run-rules.js
+++ b/lib/core/public/run-rules.js
@@ -3,6 +3,7 @@
// Clean up after resolve / reject
function cleanup() {
+ axe._cache = undefined;
axe._tree = undefined;
axe._selectorData = undefined;
}
@@ -18,6 +19,10 @@ function cleanup() {
function runRules(context, options, resolve, reject) {
'use strict';
try {
+ axe._cache = {
+ nodeMap: new WeakMap()
+ };
+
context = new Context(context);
axe._tree = context.flatTree;
axe._selectorData = axe.utils.getSelectorData(context.flatTree);
diff --git a/lib/core/utils/flattened-tree.js b/lib/core/utils/flattened-tree.js
index a60c70b19b..5012acb2d3 100644
--- a/lib/core/utils/flattened-tree.js
+++ b/lib/core/utils/flattened-tree.js
@@ -28,10 +28,11 @@ var axe = axe || { utils: {} };
*/
function virtualDOMfromNode(node, shadowId) {
const vNodeCache = {};
- return {
+ const vNode = {
shadowId: shadowId,
children: [],
actualNode: node,
+ _isHidden: null, // will be populated by axe.utils.isHidden
get isFocusable() {
if (!vNodeCache._isFocusable) {
vNodeCache._isFocusable = axe.commons.dom.isFocusable(node);
@@ -47,6 +48,8 @@ function virtualDOMfromNode(node, shadowId) {
return vNodeCache._tabbableElements;
}
};
+ axe._cache.nodeMap.set(node, vNode);
+ return vNode;
}
/**
@@ -144,26 +147,12 @@ axe.utils.getFlattenedTree = function(node, shadowId) {
};
/**
- * Recursively return a single node from a virtual dom tree
+ * Return a single node from the virtual dom tree
*
* @param {Object} vNode The flattened, virtual DOM tree
* @param {Node} node The HTML DOM node
*/
axe.utils.getNodeFromTree = function(vNode, node) {
- var found;
-
- if (vNode.actualNode === node) {
- return vNode;
- }
- vNode.children.forEach(candidate => {
- if (found) {
- return;
- }
- if (candidate.actualNode === node) {
- found = candidate;
- } else {
- found = axe.utils.getNodeFromTree(candidate, node);
- }
- });
- return found;
+ const el = node || vNode;
+ return axe._cache.nodeMap.get(el);
};
diff --git a/lib/core/utils/is-hidden.js b/lib/core/utils/is-hidden.js
index d56a531f44..82e93c937a 100644
--- a/lib/core/utils/is-hidden.js
+++ b/lib/core/utils/is-hidden.js
@@ -8,7 +8,7 @@
*/
axe.utils.isHidden = function isHidden(el, recursed) {
'use strict';
- var parent;
+ const node = axe.utils.getNodeFromTree(el);
// 9 === Node.DOCUMENT
if (el.nodeType === 9) {
@@ -20,7 +20,11 @@ axe.utils.isHidden = function isHidden(el, recursed) {
el = el.host; // grab the host Node
}
- var style = window.getComputedStyle(el, null);
+ if (node && node._isHidden !== null) {
+ return node._isHidden;
+ }
+
+ const style = window.getComputedStyle(el, null);
if (
!style ||
@@ -34,7 +38,15 @@ axe.utils.isHidden = function isHidden(el, recursed) {
return true;
}
- parent = el.assignedSlot ? el.assignedSlot : el.parentNode;
+ const parent = el.assignedSlot ? el.assignedSlot : el.parentNode;
+ const isHidden = axe.utils.isHidden(parent, true);
+
+ // cache the results of the isHidden check on the parent tree
+ // so we don't have to look at the parent tree again for all its
+ // descendants
+ if (node) {
+ node._isHidden = isHidden;
+ }
- return axe.utils.isHidden(parent, true);
+ return isHidden;
};
diff --git a/lib/rules/color-contrast-matches.js b/lib/rules/color-contrast-matches.js
index f5045aa459..bb7699ddc4 100644
--- a/lib/rules/color-contrast-matches.js
+++ b/lib/rules/color-contrast-matches.js
@@ -53,10 +53,7 @@ if (nodeName === 'LABEL' || nodeParentLabel) {
if (nodeParentLabel) {
relevantNode = nodeParentLabel;
// we need an input candidate from a parent to account for label children
- relevantVirtualNode = axe.utils.getNodeFromTree(
- axe._tree[0],
- nodeParentLabel
- );
+ relevantVirtualNode = axe.utils.getNodeFromTree(nodeParentLabel);
}
// explicit label of disabled input
let doc = axe.commons.dom.getRootNode(relevantNode);
diff --git a/package.json b/package.json
index f0f9f75ffa..0e17d7e199 100644
--- a/package.json
+++ b/package.json
@@ -122,7 +122,8 @@
"sri-toolbox": "^0.2.0",
"standard-version": "^5.0.0",
"typescript": "^2.9.2",
- "uglify-js": "^3.4.4"
+ "uglify-js": "^3.4.4",
+ "weakmap-polyfill": "^2.0.0"
},
"dependencies": {},
"lint-staged": {
diff --git a/test/checks/aria/required-children.js b/test/checks/aria/required-children.js
index eeb51ff1ad..7ebb0dbefc 100644
--- a/test/checks/aria/required-children.js
+++ b/test/checks/aria/required-children.js
@@ -32,8 +32,8 @@ describe('aria-required-children', function() {
var shadowRoot = target.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = '
Nothing here.
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], target);
+ axe.testUtils.flatTreeSetup(fixture);
+ var virtualTarget = axe.utils.getNodeFromTree(target);
var params = [target, undefined, virtualTarget];
assert.isFalse(
@@ -63,8 +63,8 @@ describe('aria-required-children', function() {
var shadowRoot = target.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = 'Nothing here.
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], target);
+ axe.testUtils.flatTreeSetup(fixture);
+ var virtualTarget = axe.utils.getNodeFromTree(target);
var params = [target, undefined, virtualTarget];
assert.isFalse(
@@ -113,8 +113,8 @@ describe('aria-required-children', function() {
shadowRoot.innerHTML =
'Nothing here.
Textbox
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], target);
+ axe.testUtils.flatTreeSetup(fixture);
+ var virtualTarget = axe.utils.getNodeFromTree(target);
var params = [target, undefined, virtualTarget];
assert.isTrue(
diff --git a/test/checks/aria/required-parent.js b/test/checks/aria/required-parent.js
index 07fa75e0f2..170094e6ee 100644
--- a/test/checks/aria/required-parent.js
+++ b/test/checks/aria/required-parent.js
@@ -32,9 +32,9 @@ describe('aria-required-parent', function() {
.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = 'Nothing here.
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isFalse(
@@ -102,9 +102,9 @@ describe('aria-required-parent', function() {
.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = 'Nothing here.
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isTrue(
@@ -124,9 +124,9 @@ describe('aria-required-parent', function() {
.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = 'Nothing here.
';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isFalse(
diff --git a/test/checks/color/color-contrast.js b/test/checks/color/color-contrast.js
index e9bde325a2..5b80b48a70 100644
--- a/test/checks/color/color-contrast.js
+++ b/test/checks/color/color-contrast.js
@@ -227,7 +227,7 @@ describe('color-contrast', function() {
it('should return true when a label wraps a text input', function() {
fixtureSetup('' + 'My text ');
var target = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], target);
+ var virtualNode = axe.utils.getNodeFromTree(target);
if (window.PHANTOMJS) {
assert.ok('PhantomJS is a liar');
} else {
diff --git a/test/checks/forms/fieldset.js b/test/checks/forms/fieldset.js
index c60d82c812..5575ba1060 100644
--- a/test/checks/forms/fieldset.js
+++ b/test/checks/forms/fieldset.js
@@ -27,7 +27,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -49,7 +49,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -76,7 +76,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -103,7 +103,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -131,7 +131,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -158,7 +158,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -176,7 +176,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -202,7 +202,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -230,7 +230,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -259,7 +259,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -282,7 +282,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -304,7 +304,7 @@ describe('fieldset', function() {
'" name="uniqueyname">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -322,7 +322,7 @@ describe('fieldset', function() {
' '
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -348,7 +348,7 @@ describe('fieldset', function() {
''
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -374,7 +374,7 @@ describe('fieldset', function() {
''
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -398,7 +398,7 @@ describe('fieldset', function() {
fixtureSetup(fieldset);
var node = shadow.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -423,7 +423,7 @@ describe('fieldset', function() {
fixtureSetup(div);
var node = div.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -448,7 +448,7 @@ describe('fieldset', function() {
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
@@ -471,7 +471,7 @@ describe('fieldset', function() {
'" name="s.%$#n">'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(
checks.fieldset.evaluate.call(checkContext, node, {}, virtualNode)
);
diff --git a/test/checks/forms/group-labelledby.js b/test/checks/forms/group-labelledby.js
index daca2f19f6..de4b08f58a 100644
--- a/test/checks/forms/group-labelledby.js
+++ b/test/checks/forms/group-labelledby.js
@@ -317,9 +317,9 @@ describe('group-labelledby', function() {
type +
'" aria-labelledby="shared three" name="groupname">';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isFalse(check.evaluate.apply(checkContext, params));
@@ -355,9 +355,9 @@ describe('group-labelledby', function() {
type +
'" aria-labelledby="shared three" name="groupname">';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isFalse(check.evaluate.apply(checkContext, params));
@@ -394,9 +394,9 @@ describe('group-labelledby', function() {
type +
'" id="target" name="samename" aria-labelledby="shared three">';
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var shadowContent = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(tree[0], shadowContent);
+ var virtualTarget = axe.utils.getNodeFromTree(shadowContent);
var params = [shadowContent, undefined, virtualTarget];
assert.isTrue(check.evaluate.apply(checkContext, params));
diff --git a/test/checks/keyboard/focusable-disabled.js b/test/checks/keyboard/focusable-disabled.js
index b2bf0fed78..1c023fe289 100644
--- a/test/checks/keyboard/focusable-disabled.js
+++ b/test/checks/keyboard/focusable-disabled.js
@@ -106,9 +106,9 @@ describe('focusable-disabled', function() {
var node = fixture.querySelector('#target');
var shadow = node.attachShadow({ mode: 'open' });
shadow.innerHTML = 'Some text ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = check.evaluate.call(checkContext, node, {}, virtualNode);
assert.isFalse(actual);
}
diff --git a/test/checks/keyboard/focusable-not-tabbable.js b/test/checks/keyboard/focusable-not-tabbable.js
index c83e0aa960..a0665adf6f 100644
--- a/test/checks/keyboard/focusable-not-tabbable.js
+++ b/test/checks/keyboard/focusable-not-tabbable.js
@@ -102,9 +102,9 @@ describe('focusable-not-tabbable', function() {
var node = fixture.querySelector('#target');
var shadow = node.attachShadow({ mode: 'open' });
shadow.innerHTML = 'btn
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = check.evaluate.call(checkContext, node, {}, virtualNode);
assert.isFalse(actual);
}
diff --git a/test/checks/label/duplicate-img-label.js b/test/checks/label/duplicate-img-label.js
index 60e0aba6b0..bd15675702 100644
--- a/test/checks/label/duplicate-img-label.js
+++ b/test/checks/label/duplicate-img-label.js
@@ -13,12 +13,12 @@ describe('duplicate-img-label', function() {
it('should return false if no img is present', function() {
fixture.innerHTML = 'Plain text ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -26,11 +26,11 @@ describe('duplicate-img-label', function() {
it('should return false if no text is present', function() {
fixture.innerHTML = ' ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
var result = checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
);
assert.isFalse(result);
});
@@ -39,12 +39,12 @@ describe('duplicate-img-label', function() {
fixture.innerHTML =
' ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -53,12 +53,12 @@ describe('duplicate-img-label', function() {
fixture.innerHTML =
' Plain text ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -67,12 +67,12 @@ describe('duplicate-img-label', function() {
fixture.innerHTML =
' Plain text ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -81,12 +81,12 @@ describe('duplicate-img-label', function() {
fixture.innerHTML =
' Plain text ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -94,12 +94,12 @@ describe('duplicate-img-label', function() {
it('should return false if img and text are both blank', function() {
fixture.innerHTML = ' ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -108,12 +108,12 @@ describe('duplicate-img-label', function() {
fixture.innerHTML =
' Plain text ';
var node = fixture.querySelector('#target');
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['duplicate-img-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
diff --git a/test/checks/label/help-same-as-label.js b/test/checks/label/help-same-as-label.js
index 9cc371dae2..145383dab6 100644
--- a/test/checks/label/help-same-as-label.js
+++ b/test/checks/label/help-same-as-label.js
@@ -15,12 +15,12 @@ describe('help-same-as-label', function() {
node.setAttribute('aria-label', 'Duplicate');
fixture.appendChild(node);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['help-same-as-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -37,12 +37,12 @@ describe('help-same-as-label', function() {
fixture.appendChild(node);
fixture.appendChild(dby);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['help-same-as-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -54,12 +54,12 @@ describe('help-same-as-label', function() {
fixture.appendChild(node);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['help-same-as-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -75,12 +75,12 @@ describe('help-same-as-label', function() {
fixture.appendChild(node);
fixture.appendChild(dby);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(
checks['help-same-as-label'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
diff --git a/test/checks/label/implicit.js b/test/checks/label/implicit.js
index b292418035..e2100cd50e 100644
--- a/test/checks/label/implicit.js
+++ b/test/checks/label/implicit.js
@@ -12,7 +12,7 @@ describe('implicit-label', function() {
it('should return false if an empty label is present', function() {
fixtureSetup(' ');
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(checks['implicit-label'].evaluate(node, {}, virtualNode));
});
@@ -21,14 +21,14 @@ describe('implicit-label', function() {
'Text '
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(checks['implicit-label'].evaluate(node, {}, virtualNode));
});
it('should return true if a non-empty label is present', function() {
fixtureSetup('Text ');
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(checks['implicit-label'].evaluate(node, {}, virtualNode));
});
@@ -37,7 +37,7 @@ describe('implicit-label', function() {
node.type = 'text';
fixtureSetup(node);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isFalse(checks['implicit-label'].evaluate(node, {}, virtualNode));
});
});
diff --git a/test/checks/label/title-only.js b/test/checks/label/title-only.js
index 35f93cf152..0cd86e175d 100644
--- a/test/checks/label/title-only.js
+++ b/test/checks/label/title-only.js
@@ -15,13 +15,13 @@ describe('title-only', function() {
fixture.appendChild(node);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['title-only'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
node.setAttribute('aria-label', 'woop');
@@ -29,7 +29,7 @@ describe('title-only', function() {
checks['title-only'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
@@ -45,13 +45,13 @@ describe('title-only', function() {
fixture.appendChild(node);
fixture.appendChild(dby);
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture));
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(
checks['title-only'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
node.setAttribute('aria-label', 'woop');
@@ -59,7 +59,7 @@ describe('title-only', function() {
checks['title-only'].evaluate(
node,
undefined,
- axe.utils.getNodeFromTree(tree[0], node)
+ axe.utils.getNodeFromTree(node)
)
);
});
diff --git a/test/checks/tables/td-has-header.js b/test/checks/tables/td-has-header.js
index ac023de37c..9761b60bd7 100644
--- a/test/checks/tables/td-has-header.js
+++ b/test/checks/tables/td-has-header.js
@@ -37,7 +37,7 @@ describe('td-has-header', function() {
' ' +
' ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
var result = checks['td-has-header'].evaluate.call(checkContext, node);
@@ -49,7 +49,7 @@ describe('td-has-header', function() {
fixture.innerHTML =
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -61,7 +61,7 @@ describe('td-has-header', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -73,7 +73,7 @@ describe('td-has-header', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -86,7 +86,7 @@ describe('td-has-header', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -100,7 +100,7 @@ describe('td-has-header', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -112,7 +112,7 @@ describe('td-has-header', function() {
' hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -121,7 +121,7 @@ describe('td-has-header', function() {
fixture.innerHTML =
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -130,7 +130,7 @@ describe('td-has-header', function() {
fixture.innerHTML =
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isFalse(checks['td-has-header'].evaluate.call(checkContext, node));
@@ -147,7 +147,7 @@ describe('td-has-header', function() {
' hi hello Ok ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isFalse(checks['td-has-header'].evaluate.call(checkContext, node));
@@ -165,7 +165,7 @@ describe('td-has-header', function() {
' Hello goodbye ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isFalse(checks['td-has-header'].evaluate.call(checkContext, node));
@@ -177,7 +177,7 @@ describe('td-has-header', function() {
' Hello goodbye ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isFalse(checks['td-has-header'].evaluate.call(checkContext, node));
@@ -190,7 +190,7 @@ describe('td-has-header', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isFalse(checks['td-has-header'].evaluate.call(checkContext, node));
});
@@ -206,7 +206,7 @@ describe('td-has-header', function() {
' data ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = axe.utils.querySelectorAll(axe._tree, 'table')[0].actualNode;
assert.isTrue(checks['td-has-header'].evaluate.call(checkContext, node));
});
diff --git a/test/checks/tables/th-has-data-cells.js b/test/checks/tables/th-has-data-cells.js
index 0270d33e18..3507734a16 100644
--- a/test/checks/tables/th-has-data-cells.js
+++ b/test/checks/tables/th-has-data-cells.js
@@ -17,7 +17,7 @@ describe('th-has-data-cells', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -31,7 +31,7 @@ describe('th-has-data-cells', function() {
' hi hello ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -45,7 +45,7 @@ describe('th-has-data-cells', function() {
' H H ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -59,7 +59,7 @@ describe('th-has-data-cells', function() {
' H H ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -72,7 +72,7 @@ describe('th-has-data-cells', function() {
' ' +
' ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -91,7 +91,7 @@ describe('th-has-data-cells', function() {
' hi ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -105,7 +105,7 @@ describe('th-has-data-cells', function() {
' hi ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isUndefined(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -119,7 +119,7 @@ describe('th-has-data-cells', function() {
' hi ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isUndefined(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -132,7 +132,7 @@ describe('th-has-data-cells', function() {
' axe AXE ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = fixture.querySelector('table');
assert.isUndefined(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
@@ -150,7 +150,7 @@ describe('th-has-data-cells', function() {
' ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var node = axe.utils.querySelectorAll(axe._tree, 'table')[0].actualNode;
assert.isTrue(
checks['th-has-data-cells'].evaluate.call(checkContext, node)
diff --git a/test/checks/visibility/hidden-content.js b/test/checks/visibility/hidden-content.js
index 3319abb4d6..95c356aa3e 100644
--- a/test/checks/visibility/hidden-content.js
+++ b/test/checks/visibility/hidden-content.js
@@ -51,8 +51,8 @@ describe('hidden content', function() {
it('should skip whitelisted elements', function() {
var node = document.querySelector('head');
- axe._tree = axe.utils.getFlattenedTree(document.documentElement);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ axe.testUtils.flatTreeSetup(document.documentElement);
+ var virtualNode = axe.utils.getNodeFromTree(node);
assert.isTrue(
checks['hidden-content'].evaluate(node, undefined, virtualNode)
);
@@ -65,22 +65,22 @@ describe('hidden content', function() {
.attachShadow({ mode: 'open' });
shadowRoot.innerHTML =
'' + ' ' + '
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var shadow = document.querySelector('#shadow');
- var virtualShadow = axe.utils.getNodeFromTree(axe._tree[0], shadow);
+ var virtualShadow = axe.utils.getNodeFromTree(shadow);
assert.isTrue(
checks['hidden-content'].evaluate(shadow, undefined, virtualShadow)
);
var target = shadowRoot.querySelector('#target');
- var virtualTarget = axe.utils.getNodeFromTree(axe._tree[0], target);
+ var virtualTarget = axe.utils.getNodeFromTree(target);
assert.isUndefined(
checks['hidden-content'].evaluate(target, undefined, virtualTarget)
);
var content = document.querySelector('#content');
- var virtualContent = axe.utils.getNodeFromTree(axe._tree[0], content);
+ var virtualContent = axe.utils.getNodeFromTree(content);
assert.isTrue(
checks['hidden-content'].evaluate(content, undefined, virtualContent)
);
diff --git a/test/commons/color/get-background-color.js b/test/commons/color/get-background-color.js
index b6ed61dfe6..cecc58bcae 100644
--- a/test/commons/color/get-background-color.js
+++ b/test/commons/color/get-background-color.js
@@ -20,7 +20,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(128, 0, 0, 1);
assert.closeTo(actual.red, expected.red, 0.5);
@@ -44,7 +44,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var pos = fixture.querySelector('#pos');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(64, 64, 0, 1);
@@ -64,7 +64,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var under = fixture.querySelector('#under');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(64, 64, 0, 1);
assert.closeTo(actual.red, expected.red, 0.5);
@@ -90,7 +90,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var under = fixture.querySelector('#under');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(64, 64, 0, 1);
@@ -109,7 +109,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(64, 64, 0, 1);
assert.closeTo(actual.red, expected.red, 0.5);
@@ -127,7 +127,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(64, 64, 0, 1);
assert.equal(actual.red, expected.red);
@@ -146,7 +146,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
assert.isNull(actual);
assert.deepEqual(bgNodes, [target, parent]);
@@ -156,7 +156,7 @@ describe('color.getBackgroundColor', function() {
it('should return white if transparency goes all the way up to document', function() {
fixture.innerHTML = '';
var target = fixture.querySelector('#target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target);
var expected = new axe.commons.color.Color(255, 255, 255, 1);
assert.equal(actual.red, expected.red);
@@ -172,7 +172,7 @@ describe('color.getBackgroundColor', function() {
'
';
var target = fixture.querySelector('#target');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
assert.isNull(actual);
assert.deepEqual(bgNodes, [target]);
@@ -183,7 +183,7 @@ describe('color.getBackgroundColor', function() {
fixture.innerHTML =
'
' +
'Hello
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -196,7 +196,7 @@ describe('color.getBackgroundColor', function() {
fixture.innerHTML =
'
' +
'Hello
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -214,7 +214,7 @@ describe('color.getBackgroundColor', function() {
'';
var target = fixture.querySelector('#target');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(0, 128, 0, 1);
assert.equal(actual.red, expected.red);
@@ -230,7 +230,7 @@ describe('color.getBackgroundColor', function() {
'
' +
'Text oh heyyyy and here\'s a link
' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -251,7 +251,7 @@ describe('color.getBackgroundColor', function() {
'
' +
'Text oh heyyyy and here\'s a link
' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -306,7 +306,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target'),
parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(243, 243, 243, 1);
assert.equal(actual.red, expected.red);
@@ -328,7 +328,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target'),
parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(243, 243, 243, 1);
assert.equal(actual.red, expected.red);
@@ -350,7 +350,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target'),
parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(243, 243, 243, 1);
assert.equal(actual.red, expected.red);
@@ -369,7 +369,7 @@ describe('color.getBackgroundColor', function() {
var bgNodes = [];
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(255, 255, 255, 1);
assert.equal(actual.red, expected.red);
@@ -386,7 +386,7 @@ describe('color.getBackgroundColor', function() {
'';
var target = fixture.querySelector('#target');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(0, 0, 0, 1);
assert.equal(actual.red, expected.red);
@@ -404,7 +404,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(255, 255, 255, 1);
assert.equal(actual.red, expected.red);
@@ -430,7 +430,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target'),
parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(243, 243, 243, 1);
assert.equal(actual.red, expected.red);
@@ -452,7 +452,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(255, 255, 255, 1);
@@ -473,7 +473,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var parent = fixture.querySelector('#parent');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes);
var expected = new axe.commons.color.Color(255, 255, 255, 1);
@@ -496,7 +496,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var shifted = fixture.querySelector('#shifted');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, bgNodes, false);
var expected = new axe.commons.color.Color(0, 0, 0, 1);
@@ -522,7 +522,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var outcome = axe.commons.color.getBackgroundColor(target, bgNodes, false);
assert.isNull(outcome);
assert.equal(axe.commons.color.incompleteData.get('bgColor'), 'bgImage');
@@ -542,7 +542,7 @@ describe('color.getBackgroundColor', function() {
var target = fixture.querySelector('#target');
var bgNodes = [];
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var outcome = axe.commons.color.getBackgroundColor(target, bgNodes, false);
assert.isNull(outcome);
assert.equal(axe.commons.color.incompleteData.get('bgColor'), 'imgNode');
@@ -559,7 +559,7 @@ describe('color.getBackgroundColor', function() {
var bgNodes = [];
window.scroll(0, 0);
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
axe.commons.color.getBackgroundColor(targetEl, bgNodes, true);
assert.equal(window.pageYOffset, 0);
@@ -576,7 +576,7 @@ describe('color.getBackgroundColor', function() {
var bgNodes = [];
window.scroll(0, 0);
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
axe.commons.color.getBackgroundColor(targetEl, bgNodes, false);
assert.notEqual(window.pageYOffset, 0);
@@ -588,7 +588,7 @@ describe('color.getBackgroundColor', function() {
'style="z-index:-1; position:absolute; width:100%; height:2em; background: #000">' +
'Some text
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -610,7 +610,7 @@ describe('color.getBackgroundColor', function() {
var orig = document.body.style.background;
document.body.style.background = '#FFF';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -631,7 +631,7 @@ describe('color.getBackgroundColor', function() {
var orig = document.body.style.background;
document.body.style.background = '#F00';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -650,7 +650,7 @@ describe('color.getBackgroundColor', function() {
var orig = document.body.style.background;
document.body.style.background = '#F00';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -669,7 +669,7 @@ describe('color.getBackgroundColor', function() {
var orig = document.documentElement.style.background;
document.documentElement.style.background = '#0F0';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(
document.getElementById('target'),
[]
@@ -697,7 +697,7 @@ describe('color.getBackgroundColor', function() {
// This shouldn't cause a scroll
var target1 = document.getElementById('tgt1');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
axe.commons.color.getBackgroundColor(target1, []);
// Otherwise this would not be on the black bg anymore:
@@ -716,7 +716,7 @@ describe('color.getBackgroundColor', function() {
html += 'foo ';
}
fixture.innerHTML = '' + html + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var outcome = axe.commons.color.getBackgroundColor(fixture.firstChild, []);
assert.isNull(outcome);
assert.equal(
@@ -730,7 +730,7 @@ describe('color.getBackgroundColor', function() {
'';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = fixture.querySelector('#target');
var actual = axe.commons.color.getBackgroundColor(target, []);
@@ -748,7 +748,7 @@ describe('color.getBackgroundColor', function() {
'' +
'Text ' +
'
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = shadow.querySelector('#shadowTarget');
var actual = axe.commons.color.getBackgroundColor(target, []);
@@ -768,7 +768,7 @@ describe('color.getBackgroundColor', function() {
var shadow = container.attachShadow({ mode: 'open' });
shadow.innerHTML =
'Text ';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = shadow.querySelector('#shadowTarget');
var actual = axe.commons.color.getBackgroundColor(target, [], false);
@@ -790,7 +790,7 @@ describe('color.getBackgroundColor', function() {
'Text
';
var target = shadow.querySelector('#target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, []);
var expected = new axe.commons.color.Color(0, 0, 0, 1);
@@ -810,10 +810,10 @@ describe('color.getBackgroundColor', function() {
var shadow = container.attachShadow({ mode: 'open' });
shadow.innerHTML =
'Text
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = shadow.querySelector('#shadowTarget');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(target, []);
assert.equal(actual.red, 255);
assert.equal(actual.green, 255);
@@ -834,7 +834,7 @@ describe('color.getBackgroundColor', function() {
shadow1.innerHTML =
'
';
var elm2 = document.querySelector('#elm2');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(elm2, []);
assert.equal(actual.red, 0);
assert.equal(actual.blue, 0);
@@ -863,7 +863,7 @@ describe('color.getBackgroundColor', function() {
'';
var elm3 = shadow2.querySelector('#elm3');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var actual = axe.commons.color.getBackgroundColor(elm3, []);
assert.closeTo(actual.red, 128, 2);
assert.closeTo(actual.blue, 128, 2);
@@ -881,7 +881,7 @@ describe('color.getBackgroundColor', function() {
var shadow = container.attachShadow({ mode: 'open' });
shadow.innerHTML =
'Text More text
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = shadow.querySelector('#shadowTarget');
var actual = axe.commons.color.getBackgroundColor(target, []);
assert.equal(actual.red, 0);
@@ -900,7 +900,7 @@ describe('color.getBackgroundColor', function() {
var shadow = container.attachShadow({ mode: 'open' });
shadow.innerHTML =
'Text More text
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var target = shadow.querySelector('#shadowTarget');
var actual = axe.commons.color.getBackgroundColor(target, []);
assert.isNull(actual);
@@ -915,7 +915,7 @@ describe('color.getBackgroundColor', function() {
div.innerHTML = 'Link ';
var shadow = div.attachShadow({ mode: 'open' });
shadow.innerHTML = '
';
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
var linkElm = div.querySelector('a');
var actual = axe.commons.color.getBackgroundColor(linkElm, []);
assert.equal(actual.red, 0);
diff --git a/test/commons/dom/find-up.js b/test/commons/dom/find-up.js
index 983c7b0125..ab2bc7704a 100644
--- a/test/commons/dom/find-up.js
+++ b/test/commons/dom/find-up.js
@@ -18,7 +18,7 @@ describe('dom.findUp', function() {
var start = document.getElementById('start'),
target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(
axe.commons.dom.findUp(start, '.target'),
target,
@@ -30,7 +30,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = '
';
var start = document.getElementById('start');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isNull(axe.commons.dom.findUp(start, '.nomatchyplzkthx'));
});
@@ -38,7 +38,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = '
';
var start = document.getElementById('start');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isNull(axe.commons.dom.findUp(start, '.target'));
});
@@ -60,7 +60,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = ' ';
makeShadowTree(fixture.querySelector('div'));
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture.firstChild));
+ var tree = axe.testUtils.flatTreeSetup(fixture.firstChild);
var el = axe.utils.querySelectorAll(tree, 'a')[0];
assert.equal(
axe.commons.dom.findUp(el.actualNode, 'label'),
@@ -86,7 +86,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = '
';
makeShadowTree(fixture.querySelector('div'));
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture.firstChild));
+ var tree = axe.testUtils.flatTreeSetup(fixture.firstChild);
var el = axe.utils.querySelectorAll(tree, 'a')[0];
assert.equal(
axe.commons.dom.findUp(el.actualNode, 'label'),
@@ -104,7 +104,7 @@ describe('dom.findUp', function() {
shadow.innerHTML = 'item 1
';
var listItem = shadow.querySelector('[role=listitem]');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(
axe.commons.dom.findUp(listItem, '[role=list]'),
fixture.firstChild
@@ -128,7 +128,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = ' ';
makeShadowTree(fixture.querySelector('div'));
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture.firstChild));
+ var tree = axe.testUtils.flatTreeSetup(fixture.firstChild);
var el = axe.utils.querySelectorAll(tree, 'a')[0];
assert.equal(
axe.commons.dom.findUp(el.actualNode, 'label'),
@@ -155,7 +155,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = ' ';
makeShadowTree(fixture.querySelector('div'));
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture.firstChild));
+ var tree = axe.testUtils.flatTreeSetup(fixture.firstChild);
var el = axe.utils.querySelectorAll(tree, 'a')[0];
var target = axe.utils.querySelectorAll(tree, '.target')[0];
assert.equal(
@@ -180,7 +180,7 @@ describe('dom.findUp', function() {
fixture.innerHTML = '
';
makeShadowTree(fixture.querySelector('div'));
- var tree = (axe._tree = axe.utils.getFlattenedTree(fixture.firstChild));
+ var tree = axe.testUtils.flatTreeSetup(fixture.firstChild);
var el = axe.utils.querySelectorAll(tree, 'a')[0];
assert.equal(
axe.commons.dom.findUp(el.actualNode, 'label'),
@@ -199,7 +199,7 @@ describe('dom.findUp', function() {
shadow.innerHTML = 'item 1
';
var listItem = shadow.querySelector('[role=listitem]');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(
axe.commons.dom.findUp(listItem, '[role=list]'),
fixture.firstChild
diff --git a/test/commons/dom/get-tabbable-elements.js b/test/commons/dom/get-tabbable-elements.js
index f5f5f53318..da584767ba 100644
--- a/test/commons/dom/get-tabbable-elements.js
+++ b/test/commons/dom/get-tabbable-elements.js
@@ -18,7 +18,7 @@ describe('dom.getTabbableElements', function() {
''
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 1);
assert.equal(actual[0].actualNode.nodeName.toUpperCase(), 'TEXTAREA');
@@ -29,7 +29,7 @@ describe('dom.getTabbableElements', function() {
'' + ' ' + '
'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 0);
});
@@ -39,7 +39,7 @@ describe('dom.getTabbableElements', function() {
'' + 'Submit Me ' + '
'
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 0);
});
@@ -49,7 +49,7 @@ describe('dom.getTabbableElements', function() {
''
);
var node = fixture.querySelector('#target');
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 0);
});
@@ -62,9 +62,9 @@ describe('dom.getTabbableElements', function() {
var shadow = node.attachShadow({ mode: 'open' });
shadow.innerHTML = 'btn ';
// re build tree after shadowDOM is constructed
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 1);
assert.equal(actual[0].actualNode.nodeName.toUpperCase(), 'BUTTON');
@@ -79,9 +79,9 @@ describe('dom.getTabbableElements', function() {
var shadow = node.attachShadow({ mode: 'open' });
shadow.innerHTML = 'btn ';
// re build tree after shadowDOM is constructed
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 0);
}
@@ -95,9 +95,9 @@ describe('dom.getTabbableElements', function() {
var shadow = node.attachShadow({ mode: 'open' });
shadow.innerHTML = 'I am not tabbable
';
// re build tree after shadowDOM is constructed
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
axe._selectorData = axe.utils.getSelectorData(axe._tree);
- var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node);
+ var virtualNode = axe.utils.getNodeFromTree(node);
var actual = getTabbableElementsFn(virtualNode);
assert.lengthOf(actual, 0);
}
diff --git a/test/commons/dom/has-content-virtual.js b/test/commons/dom/has-content-virtual.js
index 3016512711..43e0f3ac12 100644
--- a/test/commons/dom/has-content-virtual.js
+++ b/test/commons/dom/has-content-virtual.js
@@ -66,11 +66,11 @@ describe('dom.hasContentVirtual', function() {
it('is called through hasContent, with a DOM node', function() {
var hasContent = axe.commons.dom.hasContent;
fixture.innerHTML = ' text
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
assert.isTrue(hasContent(fixture.querySelector('#target')));
fixture.innerHTML = '
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
assert.isFalse(hasContent(fixture.querySelector('#target')));
});
diff --git a/test/commons/table/get-cell-position.js b/test/commons/table/get-cell-position.js
index 5d498f09d9..22ee8a4e10 100644
--- a/test/commons/table/get-cell-position.js
+++ b/test/commons/table/get-cell-position.js
@@ -17,7 +17,7 @@ describe('table.getCellPosition', function() {
var target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getCellPosition(target), {
x: 1,
y: 1
@@ -34,7 +34,7 @@ describe('table.getCellPosition', function() {
var target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getCellPosition(target), {
x: 2,
y: 1
@@ -51,7 +51,7 @@ describe('table.getCellPosition', function() {
var target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getCellPosition(target), {
x: 2,
y: 1
@@ -68,7 +68,7 @@ describe('table.getCellPosition', function() {
var target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getCellPosition(target), {
x: 2,
y: 1
@@ -87,7 +87,7 @@ describe('table.getCellPosition', function() {
var target = document.getElementById('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getCellPosition(target), {
x: 1,
y: 2
diff --git a/test/commons/table/get-headers.js b/test/commons/table/get-headers.js
index b48b64ec9d..26829b8a57 100644
--- a/test/commons/table/get-headers.js
+++ b/test/commons/table/get-headers.js
@@ -20,7 +20,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2')
@@ -36,7 +36,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2')
@@ -53,7 +53,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2'),
@@ -70,7 +70,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2'),
@@ -87,7 +87,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [$id('t1')]);
});
@@ -100,7 +100,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2')
@@ -116,7 +116,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), [
$id('t1'),
$id('t2'),
@@ -133,7 +133,7 @@ describe('table.getHeaders', function() {
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.deepEqual(axe.commons.table.getHeaders(target), []);
});
});
diff --git a/test/commons/table/get-scope.js b/test/commons/table/get-scope.js
index 93408f9c27..68f4153d67 100644
--- a/test/commons/table/get-scope.js
+++ b/test/commons/table/get-scope.js
@@ -46,7 +46,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'auto');
});
@@ -58,7 +58,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'auto');
});
@@ -70,7 +70,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'auto');
});
});
@@ -117,7 +117,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'col');
});
@@ -129,7 +129,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'col');
});
@@ -141,7 +141,7 @@ describe('table.getScope', function() {
' ' +
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'col');
});
@@ -152,7 +152,7 @@ describe('table.getScope', function() {
' ' +
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'col');
});
});
@@ -199,7 +199,7 @@ describe('table.getScope', function() {
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'row');
});
@@ -210,7 +210,7 @@ describe('table.getScope', function() {
' ' +
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'row');
});
@@ -222,7 +222,7 @@ describe('table.getScope', function() {
' ' +
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'row');
});
});
@@ -234,7 +234,7 @@ describe('table.getScope', function() {
' foo bar ' +
'';
var target = $id('target');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.equal(axe.commons.table.getScope(target), 'auto');
});
});
diff --git a/test/commons/table/is-data-table.js b/test/commons/table/is-data-table.js
index 0ce1f115f2..e2a7e6cb76 100644
--- a/test/commons/table/is-data-table.js
+++ b/test/commons/table/is-data-table.js
@@ -40,7 +40,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -48,7 +48,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -56,7 +56,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -64,7 +64,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '
';
var node = fixture.querySelector('[role="table"]');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -73,56 +73,56 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('banner', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('complementary', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('contentinfo', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('form', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('main', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('navigation', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('search', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
});
@@ -135,7 +135,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -143,7 +143,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -151,7 +151,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -159,7 +159,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -167,7 +167,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -175,7 +175,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -183,7 +183,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -191,7 +191,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -200,7 +200,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -209,7 +209,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -218,7 +218,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -227,7 +227,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -236,7 +236,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -245,21 +245,21 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
fixture.innerHTML =
'';
node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
fixture.innerHTML =
'';
node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -270,7 +270,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('#out');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -279,7 +279,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -287,7 +287,7 @@ describe('table.isDataTable', function() {
fixture.innerHTML = '';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -299,7 +299,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -311,7 +311,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -328,7 +328,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
@@ -348,7 +348,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('should be true if it has 20 or more rows', function() {
@@ -358,7 +358,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
it('should be false if its width is 95% of the document width', function() {
@@ -368,7 +368,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -379,7 +379,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -391,7 +391,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -403,7 +403,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -415,7 +415,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -428,7 +428,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isFalse(axe.commons.table.isDataTable(node));
});
@@ -439,7 +439,7 @@ describe('table.isDataTable', function() {
'';
var node = fixture.querySelector('table');
- axe._tree = axe.utils.getFlattenedTree(fixture.firstChild);
+ axe.testUtils.flatTreeSetup(fixture.firstChild);
assert.isTrue(axe.commons.table.isDataTable(node));
});
});
diff --git a/test/commons/text/accessible-text.js b/test/commons/text/accessible-text.js
index 9280a82b6f..18e072db83 100644
--- a/test/commons/text/accessible-text.js
+++ b/test/commons/text/accessible-text.js
@@ -12,7 +12,7 @@ describe('text.accessibleTextVirtual', function() {
it('is called through accessibleText with a DOM node', function() {
var accessibleText = axe.commons.text.accessibleText;
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('input');
assert.equal(accessibleText(target), '');
});
@@ -31,7 +31,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var rule2a = axe.utils.querySelectorAll(axe._tree, '#rule2a')[0];
var rule2c = axe.utils.querySelectorAll(axe._tree, '#rule2c')[0];
@@ -56,7 +56,7 @@ describe('text.accessibleTextVirtual', function() {
' times' +
' ' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var rule2a = axe.utils.querySelectorAll(axe._tree, '#beep')[0];
var rule2b = axe.utils.querySelectorAll(axe._tree, '#flash')[0];
@@ -77,7 +77,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(
@@ -93,7 +93,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(
@@ -109,7 +109,7 @@ describe('text.accessibleTextVirtual', function() {
'secret ' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(
@@ -121,7 +121,7 @@ describe('text.accessibleTextVirtual', function() {
it('should allow setting the initial includeHidden value', function() {
fixture.innerHTML =
'hidden label ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#lbl1')[0];
assert.equal(
@@ -146,7 +146,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'ARIA Label');
@@ -160,7 +160,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(
@@ -177,7 +177,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(
@@ -194,7 +194,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -207,7 +207,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'HTML Label');
@@ -220,7 +220,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2label')[0];
assert.equal(
@@ -236,7 +236,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2label')[0];
assert.equal(
@@ -254,7 +254,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2label')[0];
// Chrome 72: This is This is a label of
@@ -270,7 +270,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'My form input ' +
'
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -283,7 +283,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'
' +
'My form input ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -298,7 +298,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2label')[0];
assert.equal(
@@ -317,7 +317,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
assert.equal(
@@ -333,7 +333,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
assert.equal(
@@ -349,7 +349,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
// Chrome 70: "This is This is a label of everything"
@@ -370,7 +370,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
// Chrome 70: "This is This is a label of everything"
@@ -389,7 +389,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
// Chrome 70: "This is This is a label of everything"
@@ -409,7 +409,7 @@ describe('text.accessibleTextVirtual', function() {
'This is a label
' +
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t2')[0];
assert.equal(
@@ -427,7 +427,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
// Chrome 70: ""
// Firefox 62: "Chosen"
@@ -445,7 +445,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
});
@@ -462,7 +462,7 @@ describe('text.accessibleTextVirtual', function() {
'Mountains ' +
'' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
});
@@ -476,7 +476,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#target')[0];
// Chrome 70: ""
// Firefox 62: ""
@@ -486,7 +486,7 @@ describe('text.accessibleTextVirtual', function() {
it('shoud properly fall back to title', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -494,7 +494,7 @@ describe('text.accessibleTextVirtual', function() {
it('should give text even for role=presentation on anchors', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -502,7 +502,7 @@ describe('text.accessibleTextVirtual', function() {
it('should give text even for role=presentation on buttons', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -510,21 +510,21 @@ describe('text.accessibleTextVirtual', function() {
it('should give text even for role=presentation on summary', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'summary')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
});
it('shoud properly fall back to title', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
});
it('should give text even for role=none on anchors', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -532,7 +532,7 @@ describe('text.accessibleTextVirtual', function() {
it('should give text even for role=none on buttons', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -540,7 +540,7 @@ describe('text.accessibleTextVirtual', function() {
it('should give text even for role=none on summary', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'summary')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -548,7 +548,7 @@ describe('text.accessibleTextVirtual', function() {
it('should not add extra spaces around phrasing elements', function() {
fixture.innerHTML = 'HelloWorld ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'HelloWorld');
@@ -556,7 +556,7 @@ describe('text.accessibleTextVirtual', function() {
it('should add spaces around non-phrasing elements', function() {
fixture.innerHTML = 'HelloWorld
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello World');
@@ -565,7 +565,7 @@ describe('text.accessibleTextVirtual', function() {
it('should not look at scripts', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -573,7 +573,7 @@ describe('text.accessibleTextVirtual', function() {
it('should use for input buttons', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -595,7 +595,7 @@ describe('text.accessibleTextVirtual', function() {
'HTML Label ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, '#t1')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -614,7 +614,7 @@ describe('text.accessibleTextVirtual', function() {
.attachShadow({ mode: 'open' });
shadow.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -634,7 +634,7 @@ describe('text.accessibleTextVirtual', function() {
.attachShadow({ mode: 'open' });
shadow.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -655,7 +655,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
'Fallback content heroes ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
axe.commons.text.accessibleTextVirtual(target),
@@ -669,7 +669,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
' +
'Not part of a11yName Fail ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -678,7 +678,7 @@ describe('text.accessibleTextVirtual', function() {
it('should check aria-label', function() {
fixture.innerHTML =
'Not part of a11yName Fail ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -687,7 +687,7 @@ describe('text.accessibleTextVirtual', function() {
it('should check the figures figcaption', function() {
fixture.innerHTML =
'Not part of a11yName Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -696,7 +696,7 @@ describe('text.accessibleTextVirtual', function() {
it('should check title on figure', function() {
fixture.innerHTML =
'Not part of a11yName ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -704,7 +704,7 @@ describe('text.accessibleTextVirtual', function() {
it('should fall back to innerText of figure', function() {
fixture.innerHTML = 'Hello ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -719,7 +719,7 @@ describe('text.accessibleTextVirtual', function() {
shadowRoot.innerHTML =
'Not part of a11yName ';
fixture.appendChild(node);
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'figure')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -732,7 +732,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'img')[0];
assert.equal(
@@ -743,7 +743,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with aria-label attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'img')[0];
assert.equal(
@@ -754,7 +754,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with alt attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'img')[0];
assert.equal(
@@ -765,7 +765,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with title attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'img')[0];
assert.equal(
@@ -778,7 +778,7 @@ describe('text.accessibleTextVirtual', function() {
describe('input buttons', function() {
it('should find value for input type=button', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -786,7 +786,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find value for input type=reset', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -794,7 +794,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find value for input type=submit', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -802,7 +802,7 @@ describe('text.accessibleTextVirtual', function() {
it('should provide a default value for input type="submit"', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
@@ -815,7 +815,7 @@ describe('text.accessibleTextVirtual', function() {
it('should provide a default value for input type="reset"', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
var defaultText = axe.commons.text.accessibleTextVirtual(target);
@@ -827,7 +827,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find title for input type=button', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Hello');
@@ -835,7 +835,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find title for input type=reset', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
// IE does not use title; but will use default value instead
@@ -847,7 +847,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find title for input type=submit', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
// Again, default value takes precedence over title
@@ -863,7 +863,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -874,7 +874,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with aria-label', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -886,7 +886,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with the caption element', function() {
fixture.innerHTML =
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -897,7 +897,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with the title attribute', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -908,7 +908,7 @@ describe('text.accessibleTextVirtual', function() {
it('should work with the summary attribute', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -922,7 +922,7 @@ describe('text.accessibleTextVirtual', function() {
// Firefox 62: "Hello world"
// Safari 12.0: "FAIL"
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'table')[0];
assert.equal(
@@ -943,7 +943,7 @@ describe('text.accessibleTextVirtual', function() {
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -958,7 +958,7 @@ describe('text.accessibleTextVirtual', function() {
types.forEach(function(type) {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -974,7 +974,7 @@ describe('text.accessibleTextVirtual', function() {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML =
'Hello World' + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -990,7 +990,7 @@ describe('text.accessibleTextVirtual', function() {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML =
'Hello World ' + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1006,7 +1006,7 @@ describe('text.accessibleTextVirtual', function() {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML =
'Hello World' + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1022,7 +1022,7 @@ describe('text.accessibleTextVirtual', function() {
types.forEach(function(type) {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1037,7 +1037,7 @@ describe('text.accessibleTextVirtual', function() {
types.forEach(function(type) {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1052,7 +1052,7 @@ describe('text.accessibleTextVirtual', function() {
types.forEach(function(type) {
var t = type ? ' type="' + type + '"' : '';
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -1065,7 +1065,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1076,7 +1076,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find aria-label', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1088,7 +1088,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find an implicit label', function() {
fixture.innerHTML =
'Hello World' + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1100,7 +1100,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find an explicit label', function() {
fixture.innerHTML =
'Hello World ' + '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1112,7 +1112,7 @@ describe('text.accessibleTextVirtual', function() {
// not implemented yet, doesn't work accross ATs
it.skip('should find a placeholder attribute', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1123,7 +1123,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find a title attribute', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(
@@ -1134,7 +1134,7 @@ describe('text.accessibleTextVirtual', function() {
it('should otherwise be empty string', function() {
fixture.innerHTML = '';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'textarea')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -1146,7 +1146,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1157,7 +1157,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find aria-label', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1168,7 +1168,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find an alt attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1179,7 +1179,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find a title attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(
@@ -1190,7 +1190,7 @@ describe('text.accessibleTextVirtual', function() {
it('should otherwise be "Submit" string', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'input')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), 'Submit');
@@ -1202,7 +1202,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(
@@ -1213,7 +1213,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find aria-label', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(
@@ -1224,7 +1224,7 @@ describe('text.accessibleTextVirtual', function() {
it('should check subtree', function() {
fixture.innerHTML = 'Hello World ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(
@@ -1235,7 +1235,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find a title attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(
@@ -1246,7 +1246,7 @@ describe('text.accessibleTextVirtual', function() {
it('should otherwise be empty string', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -1263,7 +1263,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'' +
'';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'a')[0];
assert.equal(
@@ -1278,7 +1278,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Hello
World
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(
@@ -1289,7 +1289,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find aria-label', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(
@@ -1301,7 +1301,7 @@ describe('text.accessibleTextVirtual', function() {
it('should check subtree', function() {
fixture.innerHTML =
'Hello World ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(
@@ -1312,7 +1312,7 @@ describe('text.accessibleTextVirtual', function() {
it('should find a title attribute', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(
@@ -1323,7 +1323,7 @@ describe('text.accessibleTextVirtual', function() {
it('should otherwise be empty string', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, 'button')[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -1363,15 +1363,15 @@ describe('text.accessibleTextVirtual', function() {
it('should find aria-labelledby', function() {
tags.forEach(function(tag) {
fixture.innerHTML = 'Hello
World
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var elm = document.createElement(tag);
elm.setAttribute('aria-labelledby', 't1 t2');
elm.style.display = 'inline'; // Firefox hides some of these elements because reasons...
fixture.appendChild(elm);
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
- var target = axe.utils.getNodeFromTree(axe._tree[0], elm);
+ var target = axe.utils.getNodeFromTree(elm);
var result = axe.commons.text.accessibleTextVirtual(target);
assert.equal(result, 'Hello World', tag);
});
@@ -1383,9 +1383,9 @@ describe('text.accessibleTextVirtual', function() {
elm.setAttribute('aria-label', 'Hello World');
elm.style.display = 'inline'; // Firefox hack, see above
fixture.appendChild(elm);
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
- var target = axe.utils.getNodeFromTree(axe._tree[0], elm);
+ var target = axe.utils.getNodeFromTree(elm);
var result = axe.commons.text.accessibleTextVirtual(target);
assert.equal(result, 'Hello World', tag);
});
@@ -1397,9 +1397,9 @@ describe('text.accessibleTextVirtual', function() {
elm.setAttribute('title', 'Hello World');
elm.style.display = 'inline'; // Firefox hack, see above
fixture.appendChild(elm);
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
- var target = axe.utils.getNodeFromTree(axe._tree[0], elm);
+ var target = axe.utils.getNodeFromTree(elm);
var result = axe.commons.text.accessibleTextVirtual(target);
assert.equal(result, 'Hello World', tag);
});
@@ -1408,7 +1408,7 @@ describe('text.accessibleTextVirtual', function() {
it('should otherwise be empty string', function() {
tags.forEach(function(tag) {
fixture.innerHTML = '<' + tag + '>' + tag + '>';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = axe.utils.querySelectorAll(axe._tree, tag)[0];
assert.equal(axe.commons.text.accessibleTextVirtual(target), '');
@@ -1443,7 +1443,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 1', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Rich');
});
@@ -1452,7 +1452,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Rich\'s button
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), "Rich's button");
});
@@ -1461,21 +1461,21 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'Rich\'s button
' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), "Rich's button");
});
it('passes test 4', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Reset');
});
it('passes test 5', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1483,7 +1483,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 6', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1491,7 +1491,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 7', function() {
fixture.innerHTML =
'States: ' + ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'States:');
});
@@ -1503,7 +1503,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo David');
});
@@ -1518,7 +1518,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'crazy');
});
@@ -1531,7 +1531,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
'' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'crazy Monday');
});
@@ -1544,7 +1544,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
'' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'crazy 4');
});
@@ -1552,7 +1552,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 12', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'crazy');
});
@@ -1564,7 +1564,7 @@ describe('text.accessibleTextVirtual', function() {
'' +
'fruit ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'fancy fruit');
});
@@ -1576,14 +1576,14 @@ describe('text.accessibleTextVirtual', function() {
'' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'test content');
});
it('passes test 15', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '1');
});
@@ -1591,7 +1591,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 16', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '1');
});
@@ -1602,7 +1602,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '');
});
@@ -1610,7 +1610,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 18', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '');
});
@@ -1621,7 +1621,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '');
});
@@ -1629,7 +1629,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 20', function() {
fixture.innerHTML =
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), '1');
});
@@ -1640,7 +1640,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'peanuts popcorn apple jacks');
});
@@ -1649,7 +1649,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'l peanuts');
});
@@ -1659,7 +1659,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'l peanuts popcorn');
});
@@ -1670,7 +1670,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'l peanuts popcorn apple jacks');
});
@@ -1681,7 +1681,7 @@ describe('text.accessibleTextVirtual', function() {
' ' +
' ' +
' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 't peanuts popcorn apple jacks');
});
@@ -1690,14 +1690,14 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'foo
' +
'bar ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'bar');
});
it('passes test 27', function() {
fixture.innerHTML = 'foo
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Tag');
});
@@ -1706,7 +1706,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'foo
' +
'bar ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'bar');
});
@@ -1716,7 +1716,7 @@ describe('text.accessibleTextVirtual', function() {
'foo
' +
'bar ' +
'baz ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'bar baz');
});
@@ -1724,14 +1724,14 @@ describe('text.accessibleTextVirtual', function() {
// Should only pass in strict mode
it('passes test 30', function() {
fixture.innerHTML = 'Div with text
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target, { strict: true }), '');
});
it('passes test 31', function() {
fixture.innerHTML = 'foo
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1740,7 +1740,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'' +
'
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Tag');
});
@@ -1749,7 +1749,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'foo
' +
'bar ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1757,7 +1757,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 34', function() {
fixture.innerHTML =
'ABC ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Tag');
});
@@ -1766,7 +1766,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
'foo ' +
'bar
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'bar');
});
@@ -1775,21 +1775,21 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
'foo
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Tag foo');
});
it('passes test 37', function() {
fixture.innerHTML = 'ABC ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'ABC');
});
it('passes test 38', function() {
fixture.innerHTML = ' ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'Tag');
});
@@ -1800,7 +1800,7 @@ describe('text.accessibleTextVirtual', function() {
'foo
' +
'bar
' +
'baz
';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo bar baz');
});
@@ -1809,7 +1809,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
'foo';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo bar');
});
@@ -1817,7 +1817,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 41', function() {
fixture.innerHTML =
' ' + 'foo ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1825,7 +1825,7 @@ describe('text.accessibleTextVirtual', function() {
it('passes test 42', function() {
fixture.innerHTML =
' ' + 'foo ';
- axe._tree = axe.utils.getFlattenedTree(fixture);
+ axe.testUtils.flatTreeSetup(fixture);
var target = fixture.querySelector('#test');
assert.equal(accessibleText(target), 'foo');
});
@@ -1834,7 +1834,7 @@ describe('text.accessibleTextVirtual', function() {
fixture.innerHTML =
' ' +
'foo