From 399bbc93250c4e9e2bfba6acbf18cb5144603bea Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 3 Mar 2019 13:21:03 +0000 Subject: [PATCH 001/108] chore(package): update globby to version 9.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 783a0d6fb4..b29c937ae2 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "eslint-config-prettier": "^3.4.0", "execa": "^1.0.0", "fs-extra": "^7.0.0", - "globby": "^8.0.1", + "globby": "^9.1.0", "grunt": "^1.0.3", "grunt-babel": "^7.0.0", "grunt-contrib-clean": "^2.0.0", From e7bebc4b893ee9c65054a4465175c69d730541d2 Mon Sep 17 00:00:00 2001 From: Jey Date: Tue, 12 Mar 2019 14:46:20 +0000 Subject: [PATCH 002/108] chore: run prettier (#1426) --- lib/commons/text/label-text.js | 2 +- lib/commons/text/native-text-methods.js | 2 +- lib/commons/text/subtree-text.js | 6 +- lib/core/utils/preload-cssom.js | 3 +- test/commons/text/label-text.js | 169 +++++++++++------------ test/commons/text/native-text-methods.js | 4 +- test/commons/text/subtree-text.js | 6 +- 7 files changed, 93 insertions(+), 99 deletions(-) diff --git a/lib/commons/text/label-text.js b/lib/commons/text/label-text.js index 8274916559..1954900262 100644 --- a/lib/commons/text/label-text.js +++ b/lib/commons/text/label-text.js @@ -9,7 +9,7 @@ * @return {String} Label text */ text.labelText = function labelText(virtualNode, context = {}) { - const { alreadyProcessed } = text.accessibleTextVirtual + const { alreadyProcessed } = text.accessibleTextVirtual; if ( context.inControlContext || context.inLabelledByContext || diff --git a/lib/commons/text/native-text-methods.js b/lib/commons/text/native-text-methods.js index a4a14d09ad..f588cf3232 100644 --- a/lib/commons/text/native-text-methods.js +++ b/lib/commons/text/native-text-methods.js @@ -95,7 +95,7 @@ text.nativeTextMethods = { * @return {String} Returns ` ` */ singleSpace: function singleSpace() { - return ' ' + return ' '; } }; diff --git a/lib/commons/text/subtree-text.js b/lib/commons/text/subtree-text.js index f1c4c38b75..5818a02d8a 100644 --- a/lib/commons/text/subtree-text.js +++ b/lib/commons/text/subtree-text.js @@ -8,11 +8,11 @@ * @return {String} Accessible text */ text.subtreeText = function subtreeText(virtualNode, context = {}) { - const { alreadyProcessed } = text.accessibleTextVirtual + const { alreadyProcessed } = text.accessibleTextVirtual; context.startNode = context.startNode || virtualNode; const { strict } = context; if ( - alreadyProcessed(virtualNode, context ) || + alreadyProcessed(virtualNode, context) || !aria.namedFromContents(virtualNode, { strict }) ) { return ''; @@ -72,7 +72,7 @@ function appendAccessibleText(contentText, virtualNode, context) { const nodeName = virtualNode.actualNode.nodeName.toUpperCase(); let contentTextAdd = text.accessibleTextVirtual(virtualNode, context); if (!contentTextAdd) { - return contentText + return contentText; } if (!phrasingElements.includes(nodeName)) { diff --git a/lib/core/utils/preload-cssom.js b/lib/core/utils/preload-cssom.js index c95f12181c..180a502360 100644 --- a/lib/core/utils/preload-cssom.js +++ b/lib/core/utils/preload-cssom.js @@ -1,10 +1,9 @@ /** - * NOTE: + * NOTE: * this `eslint` rule is disabled because of calling `getStyleSheetFactory` before it is defined (further below). */ /* eslint no-use-before-define: 0 */ - /** * Given a rootNode - construct CSSOM * -> get all source nodes (document & document fragments) within given root node diff --git a/test/commons/text/label-text.js b/test/commons/text/label-text.js index efb763fe2a..2d5ac9ef9e 100644 --- a/test/commons/text/label-text.js +++ b/test/commons/text/label-text.js @@ -1,125 +1,120 @@ describe('text.labelText', function() { - var labelText = axe.commons.text.labelText; var queryFixture = axe.testUtils.queryFixture; - it('returns the text of an implicit label', function () { + it('returns the text of an implicit label', function() { var target = queryFixture( - '' - ) - assert.equal(labelText(target), 'My implicit label') - }) + '' + ); + assert.equal(labelText(target), 'My implicit label'); + }); - it('returns the text of an explicit label', function () { + it('returns the text of an explicit label', function() { var target = queryFixture( - '' + - '' - ) - assert.equal(labelText(target), 'My explicit label') - }) + '' + '' + ); + assert.equal(labelText(target), 'My explicit label'); + }); - it('ignores the text of nested implicit labels', function () { + it('ignores the text of nested implicit labels', function() { var target = queryFixture( '' - ) - assert.equal(labelText(target), 'My inner label') - }) + '' + + '' + ); + assert.equal(labelText(target), 'My inner label'); + }); - it('concatinates multiple explicit labels', function () { + it('concatinates multiple explicit labels', function() { var target = queryFixture( '' + - '' + - '' - ) - assert.equal(labelText(target), 'My label 1 My label 2') - }) + '' + + '' + ); + assert.equal(labelText(target), 'My label 1 My label 2'); + }); - it('concatinates explicit and implicit labels', function () { + it('concatinates explicit and implicit labels', function() { var target = queryFixture( '' + - '' - ) - assert.equal(labelText(target), 'My explicit label My implicit label') - }) + '' + ); + assert.equal(labelText(target), 'My explicit label My implicit label'); + }); - it('returns label text in the DOM order', function () { + it('returns label text in the DOM order', function() { var target = queryFixture( '' + - '' + - '' - ) - assert.equal(labelText(target), 'Label 1 My implicit Label 2 Label 3') - }) + '' + + '' + ); + assert.equal(labelText(target), 'Label 1 My implicit Label 2 Label 3'); + }); - it('does not return the same label twice', function () { + it('does not return the same label twice', function() { var target = queryFixture( '' - ) - assert.equal(labelText(target), 'My implicit and explicit label') - }) + 'My implicit and explicit label' + + '' + + '' + ); + assert.equal(labelText(target), 'My implicit and explicit label'); + }); - it('ignores the value of a textbox', function () { + it('ignores the value of a textbox', function() { var target = queryFixture( '' - ) - assert.equal(labelText(target), 'My label') - }) + '' + + '' + ); + assert.equal(labelText(target), 'My label'); + }); - it('ignores the content of a textarea', function () { + it('ignores the content of a textarea', function() { var target = queryFixture( '' + ''; - 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() { '' + '' + ''; - 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 = ''; - 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 = ''; - 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 = 'Hello
World
'; - 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 ' + ''; - 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() { '' + '' + ''; - 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 = 'a'; - 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() { '' + '' + 'a'; - 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 = '' + ''; - 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 = '' + ''; - 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 = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -1842,7 +1842,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 44', function() { fixture.innerHTML = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -1850,7 +1850,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 45', function() { fixture.innerHTML = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -1858,7 +1858,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 46', function() { fixture.innerHTML = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -1867,7 +1867,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), 'foo bar baz'); }); @@ -1876,7 +1876,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), 'foo bar baz'); }); @@ -1885,7 +1885,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), 'foo bar baz'); }); @@ -1894,7 +1894,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), 'foo bar baz'); }); @@ -1903,7 +1903,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), 'foo bar baz'); }); @@ -1917,7 +1917,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 bar baz'); }); @@ -1931,7 +1931,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 bar baz'); }); @@ -1945,7 +1945,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 baz'); }); @@ -1959,7 +1959,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 baz'); }); @@ -1973,7 +1973,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 baz'); }); @@ -1987,7 +1987,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 baz'); }); @@ -1996,7 +1996,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), 'States:'); }); @@ -2005,7 +2005,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), 'States:'); }); @@ -2013,7 +2013,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 60', function() { fixture.innerHTML = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'States:'); }); @@ -2021,7 +2021,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 61', function() { fixture.innerHTML = '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'File:'); }); @@ -2030,7 +2030,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), 'States:'); }); @@ -2042,7 +2042,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'); }); @@ -2054,7 +2054,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'); }); @@ -2066,7 +2066,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'); }); @@ -2078,7 +2078,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'); }); @@ -2090,7 +2090,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'); }); @@ -2105,7 +2105,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'); }); @@ -2120,7 +2120,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'); }); @@ -2135,7 +2135,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'); }); @@ -2150,7 +2150,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'); }); @@ -2165,7 +2165,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'); }); @@ -2178,7 +2178,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'); }); @@ -2191,7 +2191,7 @@ describe('text.accessibleTextVirtual', function() { ' aria-valuemin="1" aria-valuemax="7" aria-valuenow="4">' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy Monday'); }); @@ -2204,7 +2204,7 @@ describe('text.accessibleTextVirtual', function() { ' aria-valuemin="1" aria-valuemax="7" aria-valuenow="4">' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy Monday'); }); @@ -2217,7 +2217,7 @@ describe('text.accessibleTextVirtual', function() { ' aria-valuemin="1" aria-valuemax="7" aria-valuenow="4">' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy Monday'); }); @@ -2230,7 +2230,7 @@ describe('text.accessibleTextVirtual', function() { ' aria-valuemax="7" aria-valuenow="4">' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy Monday'); }); @@ -2243,7 +2243,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'); }); @@ -2256,7 +2256,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'); }); @@ -2269,7 +2269,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'); }); @@ -2282,7 +2282,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'); }); @@ -2295,7 +2295,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'); }); @@ -2303,28 +2303,28 @@ describe('text.accessibleTextVirtual', function() { it('passes test 83', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy'); }); it('passes test 84', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy'); }); it('passes test 85', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy'); }); it('passes test 86', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy'); }); @@ -2332,7 +2332,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 87', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'crazy'); }); @@ -2344,7 +2344,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2356,7 +2356,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2368,7 +2368,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2380,7 +2380,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2392,7 +2392,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2404,7 +2404,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2416,7 +2416,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2428,7 +2428,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2440,7 +2440,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2452,7 +2452,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'fancy fruit'); }); @@ -2471,7 +2471,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 72: "Flash the screen 1 times" // Safari 12.0: "Flash the screen 1 times" @@ -2490,7 +2490,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen times.'); }); @@ -2506,7 +2506,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2516,7 +2516,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 5 baz'); }); @@ -2526,14 +2526,14 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo 5 baz'); }); it('passes test 103', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2552,7 +2552,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2568,7 +2568,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen times.'); }); @@ -2584,7 +2584,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2594,7 +2594,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 5 baz'); }); @@ -2604,14 +2604,14 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo 5 baz'); }); it('passes test 109', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2619,7 +2619,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 110', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2638,7 +2638,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2654,7 +2654,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen times.'); }); @@ -2670,7 +2670,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2680,7 +2680,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 5 baz'); }); @@ -2690,14 +2690,14 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo 5 baz'); }); it('passes test 116', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2716,7 +2716,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -2732,7 +2732,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen times.'); }); @@ -2748,7 +2748,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 72: "Flash the screen 1 times" // Firefox 62: "Flash the screen 1 times" @@ -2761,7 +2761,7 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 70: Foo 5 baz // Firefox 62: Foo 5 baz @@ -2774,14 +2774,14 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo 5 baz'); }); it('passes test 122', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2800,7 +2800,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 72: "Flash the screen 1 times." // Firefox 62: "Flash the screen 1 times." @@ -2819,7 +2819,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen times.'); }); @@ -2835,7 +2835,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 72: Flash the screen 1 times // Firefox 62: Flash the screen 1 times @@ -2848,7 +2848,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 5 baz'); }); @@ -2858,14 +2858,14 @@ describe('text.accessibleTextVirtual', function() { '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo 5 baz'); }); it('passes test 128', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'foo'); }); @@ -2900,7 +2900,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); // Chrome 72: "My name is Eli the weird. (QED) Where are my marbles?" // Safari 12.0: "My name is Eli the weird. (QED) Where are my marbles?" @@ -2940,7 +2940,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal( accessibleText(target), @@ -2976,7 +2976,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal( accessibleText(target), @@ -3019,7 +3019,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' ' + ' '; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Important stuff'); }); @@ -3027,7 +3027,7 @@ describe('text.accessibleTextVirtual', function() { it('passes test 144', function() { fixture.innerHTML = ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Choose your language'); }); @@ -3037,7 +3037,7 @@ describe('text.accessibleTextVirtual', function() { '
' + ' English ' + '
'; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Choose your language.'); }); @@ -3053,7 +3053,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -3065,7 +3065,7 @@ describe('text.accessibleTextVirtual', function() { '
1
' + ' times.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -3074,7 +3074,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), 'a test This is'); }); @@ -3083,7 +3083,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), 'This is a test'); }); @@ -3092,7 +3092,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), 'What is your name?'); }); @@ -3105,7 +3105,7 @@ describe('text.accessibleTextVirtual', function() { '' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'This is a test.'); }); @@ -3127,7 +3127,7 @@ describe('text.accessibleTextVirtual', function() { // ' 10' + ' 910' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), '2 4 6 8 10'); }); @@ -3148,7 +3148,7 @@ describe('text.accessibleTextVirtual', function() { '
  • 3
  • ' + ' ' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 2 times.'); }); @@ -3167,7 +3167,7 @@ describe('text.accessibleTextVirtual', function() { ' ' + ' ' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Flash the screen 1 times.'); }); @@ -3189,7 +3189,7 @@ describe('text.accessibleTextVirtual', function() { // ' ' + ' and don\'t you forget it.' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'My name is Eli the weird. (QED)'); }); @@ -3198,7 +3198,7 @@ describe('text.accessibleTextVirtual', function() { fixture.innerHTML = 'United States'; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'California'); }); @@ -3209,12 +3209,12 @@ describe('text.accessibleTextVirtual', function() { 'Country of origin:' + '' + ''; - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#test'); assert.equal(accessibleText(target), 'Country of origin: United States'); }); - /** + /** // In case anyone even wants it, here's the script used to generate these test cases function getTestCase(content, index = 0) { const regex = new RegExp('if given\n([^]*)\nthen the accessible name of the element with id of "(.*)" is "(.*)"') @@ -3222,16 +3222,16 @@ describe('text.accessibleTextVirtual', function() { if (!out || out.length !== 4) { return; } - + const [, html, id, expected] = out; const strings = html.split(/\n/g).map( line => `'${line.substr(2)}'` ).join(' +\n ') + ';' - + return ` it('passes test ${index + 1}', function () { fixture.innerHTML = ${strings} - axe._tree = axe.utils.getFlattenedTree(fixture); + axe.testUtils.flatTreeSetup(fixture); var target = fixture.querySelector('#${id}'); assert.equal(accessibleText(target), '${expected}'); });` diff --git a/test/commons/text/label-virtual.js b/test/commons/text/label-virtual.js index d92ba7b69a..a704b65b04 100644 --- a/test/commons/text/label-virtual.js +++ b/test/commons/text/label-virtual.js @@ -11,7 +11,7 @@ describe('text.labelVirtual', function() { '
    monkeys
    bananas
    ' + ''; - axe._tree = axe.utils.getFlattenedTree(document.body); + axe.testUtils.flatTreeSetup(document.body); var target = fixture.querySelector('#target'); assert.equal(axe.commons.text.label(target), 'monkeys bananas'); }); @@ -22,7 +22,7 @@ describe('text.labelVirtual', function() { '
    monkeys
    bananas
    ' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys bananas'); }); @@ -32,7 +32,7 @@ describe('text.labelVirtual', function() { '
    monkeys
    ' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -42,7 +42,7 @@ describe('text.labelVirtual', function() { '
    monkeys
    bananas
    ' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys bananas'); }); @@ -53,7 +53,7 @@ describe('text.labelVirtual', function() { '' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys bananas'); }); @@ -64,7 +64,7 @@ describe('text.labelVirtual', function() { ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys bananas'); }); @@ -74,7 +74,7 @@ describe('text.labelVirtual', function() { '
    \n
    ' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.isNull(axe.commons.text.labelVirtual(target)); }); @@ -84,7 +84,7 @@ describe('text.labelVirtual', function() { it('should detect it', function() { fixture.innerHTML = ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -92,7 +92,7 @@ describe('text.labelVirtual', function() { it('should ignore whitespace only labels', function() { fixture.innerHTML = ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.isNull(axe.commons.text.labelVirtual(target)); }); @@ -102,7 +102,7 @@ describe('text.labelVirtual', function() { '' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -111,7 +111,7 @@ describe('text.labelVirtual', function() { fixture.innerHTML = ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -122,7 +122,7 @@ describe('text.labelVirtual', function() { fixture.innerHTML = '' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -131,7 +131,7 @@ describe('text.labelVirtual', function() { fixture.innerHTML = '' + ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.isNull(axe.commons.text.labelVirtual(target)); }); @@ -142,7 +142,7 @@ describe('text.labelVirtual', function() { ''; - var tree = (axe._tree = axe.utils.getFlattenedTree(document.body)); + var tree = axe.testUtils.flatTreeSetup(document.body); var target = axe.utils.querySelectorAll(tree, '#target')[0]; assert.equal(axe.commons.text.labelVirtual(target), 'monkeys'); }); @@ -152,7 +152,7 @@ describe('text.labelVirtual', function() { it('should detect it', function() { fixture.innerHTML = '