From 743775d7078bd2faea7e1767fbf6704253ab22b5 Mon Sep 17 00:00:00 2001 From: Ava Gaiety W Date: Fri, 7 Jun 2024 10:20:02 -0500 Subject: [PATCH 1/4] style(test/rule-matches): var -> const & let related to #4444 --- .../rule-matches/aria-allowed-attr-matches.js | 8 +- .../rule-matches/aria-allowed-role-matches.js | 10 +- test/rule-matches/aria-has-attr-matches.js | 12 +- .../rule-matches/aria-hidden-focus-matches.js | 20 +-- .../aria-required-children-matches.js | 10 +- .../aria-required-parent-matches.js | 10 +- test/rule-matches/autocomplete-matches.js | 40 ++--- test/rule-matches/color-contrast-matches.js | 140 +++++++-------- test/rule-matches/data-table-matches.js | 12 +- .../duplicate-id-active-matches.js | 22 +-- .../rule-matches/duplicate-id-aria-matches.js | 22 +-- .../rule-matches/duplicate-id-misc-matches.js | 22 +-- .../frame-focusable-content-matches.js | 12 +- .../frame-title-has-text-matches.js | 10 +- .../has-implicit-chromium-role-matches.js | 14 +- test/rule-matches/heading-matches.js | 22 +-- test/rule-matches/html-namespace-matches.js | 30 ++-- test/rule-matches/html-xml-lang-mismatch.js | 18 +- .../identical-links-same-purpose-matches.js | 46 ++--- .../inserted-into-focus-order-matches.js | 16 +- test/rule-matches/is-initiator-matches.js | 4 +- test/rule-matches/is-visible-matches.js | 6 +- .../label-content-name-mismatch-matches.js | 74 ++++---- test/rule-matches/label-matches.js | 16 +- .../rule-matches/landmark-has-body-context.js | 18 +- test/rule-matches/landmark-unique-matches.js | 167 ++++-------------- test/rule-matches/layout-table-matches.js | 14 +- .../nested-interactive-matches.js | 14 +- .../rule-matches/no-autoplay-audio-matches.js | 20 +-- test/rule-matches/no-empty-role-matches.js | 34 ++-- .../no-explicit-name-required-matches.js | 34 ++-- test/rule-matches/no-naming-method-matches.js | 50 +++--- test/rule-matches/no-negative-tabindex.js | 26 +-- test/rule-matches/p-as-heading-matches.js | 18 +- .../scrollable-region-focusable-matches.js | 88 ++++----- test/rule-matches/skip-link-matches.js | 4 +- test/rule-matches/svg-namespace-matches.js | 36 ++-- 37 files changed, 510 insertions(+), 609 deletions(-) diff --git a/test/rule-matches/aria-allowed-attr-matches.js b/test/rule-matches/aria-allowed-attr-matches.js index 5b7dfb33a6..f8ae7b8948 100644 --- a/test/rule-matches/aria-allowed-attr-matches.js +++ b/test/rule-matches/aria-allowed-attr-matches.js @@ -1,8 +1,8 @@ describe('aria-allowed-attr-matches', function () { 'use strict'; - var queryFixture = axe.testUtils.queryFixture; - var rule; + let queryFixture = axe.testUtils.queryFixture; + let rule; beforeEach(function () { rule = axe.utils.getRule('aria-allowed-attr'); @@ -13,7 +13,7 @@ describe('aria-allowed-attr-matches', function () { }); it('should return true on elements that have aria attributes', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
' ); @@ -21,7 +21,7 @@ describe('aria-allowed-attr-matches', function () { }); it('should return false on elements that have no aria attributes', function () { - var vNode = queryFixture('
'); + let vNode = queryFixture('
'); assert.isFalse(rule.matches(null, vNode)); }); diff --git a/test/rule-matches/aria-allowed-role-matches.js b/test/rule-matches/aria-allowed-role-matches.js index 28992fde4c..1f9e4853b4 100644 --- a/test/rule-matches/aria-allowed-role-matches.js +++ b/test/rule-matches/aria-allowed-role-matches.js @@ -1,27 +1,27 @@ describe('aria-allowed-role-matches', function () { 'use strict'; - var queryFixture = axe.testUtils.queryFixture; - var rule; + let queryFixture = axe.testUtils.queryFixture; + let rule; beforeEach(function () { rule = axe.utils.getRule('aria-allowed-role'); }); it('return false (no matches) for a with a href to have any invalid role', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); assert.isFalse(rule.matches(null, vNode)); }); it('return true for input with redundant role', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); }); it('return true for element with valid role', function () { - var vNode = queryFixture('
    '); + let vNode = queryFixture('
      '); assert.isTrue(rule.matches(null, vNode)); }); }); diff --git a/test/rule-matches/aria-has-attr-matches.js b/test/rule-matches/aria-has-attr-matches.js index c3e0adbb52..9e714f8b19 100644 --- a/test/rule-matches/aria-has-attr-matches.js +++ b/test/rule-matches/aria-has-attr-matches.js @@ -1,9 +1,9 @@ describe('aria-has-attr-matches', function () { 'use strict'; - var queryFixture = axe.testUtils.queryFixture; - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let queryFixture = axe.testUtils.queryFixture; + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('aria-valid-attr-value'); @@ -14,16 +14,16 @@ describe('aria-has-attr-matches', function () { }); it('should return false if an element has no attributes', function () { - var vNode = fixtureSetup('
      '); + let vNode = fixtureSetup('
      '); assert.isFalse(rule.matches(null, vNode)); }); it('should return false if an element has no ARIA attributes', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isFalse(rule.matches(null, vNode)); }); it('should return true if an element has ARIA attributes', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isTrue(rule.matches(null, vNode)); }); }); diff --git a/test/rule-matches/aria-hidden-focus-matches.js b/test/rule-matches/aria-hidden-focus-matches.js index b770c88323..5ef1b58dc7 100644 --- a/test/rule-matches/aria-hidden-focus-matches.js +++ b/test/rule-matches/aria-hidden-focus-matches.js @@ -1,8 +1,8 @@ describe('aria-hidden-focus-matches', function () { 'use strict'; - var rule; - var queryFixture = axe.testUtils.queryFixture; + let rule; + let queryFixture = axe.testUtils.queryFixture; beforeEach(function () { rule = axe.utils.getRule('aria-hidden-focus'); @@ -13,24 +13,24 @@ describe('aria-hidden-focus-matches', function () { }); it('return true when there is no parent with aria-hidden', function () { - var vNode = queryFixture('
      ' + '
      '); - var actual = rule.matches(vNode.actualNode); + let vNode = queryFixture('
      ' + '
      '); + let actual = rule.matches(vNode.actualNode); assert.isTrue(actual); }); it('return false when has a parent element with aria-hidden', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode); + let actual = rule.matches(vNode.actualNode); assert.isFalse(actual); }); it('return false when has any parent element with aria-hidden', function () { - var vNode = queryFixture( + let vNode = queryFixture( ' `; - var target = fixture.querySelector('#target'); + let target = fixture.querySelector('#target'); axe.testUtils.flatTreeSetup(fixture); assert.isFalse(rule.matches(target, axe.utils.getNodeFromTree(target))); }); @@ -436,13 +436,13 @@ describe('color-contrast-matches', function () { fixture.innerHTML = '
      ' + '
      '; - var shadowRoot = document + let shadowRoot = document .getElementById('parent') .attachShadow({ mode: 'open' }); shadowRoot.innerHTML = '
      Text
      '; - var shadowTarget = + let shadowTarget = fixture.firstChild.shadowRoot.querySelector('#shadowTarget'); axe.testUtils.flatTreeSetup(fixture); assert.isTrue( @@ -453,7 +453,7 @@ describe('color-contrast-matches', function () { it('should look at the correct root node when looking up an explicit label and disabled input', function () { fixture.innerHTML = '
      ' + '' + '
      '; - var shadowRoot = document + let shadowRoot = document .getElementById('parent') .attachShadow({ mode: 'open' }); shadowRoot.innerHTML = @@ -462,7 +462,7 @@ describe('color-contrast-matches', function () { '' + ''; - var shadowLabel = + let shadowLabel = fixture.firstChild.shadowRoot.querySelector('#shadowLabel'); axe.testUtils.flatTreeSetup(fixture); assert.isFalse( @@ -473,7 +473,7 @@ describe('color-contrast-matches', function () { it('should look at the correct root node when looking up implicit label and disabled input', function () { fixture.innerHTML = '
      ' + '' + '
      '; - var shadowRoot = document + let shadowRoot = document .getElementById('parent') .attachShadow({ mode: 'open' }); shadowRoot.innerHTML = @@ -481,7 +481,7 @@ describe('color-contrast-matches', function () { '' + ''; - var shadowLabel = + let shadowLabel = fixture.firstChild.shadowRoot.querySelector('#shadowLabel'); axe.testUtils.flatTreeSetup(fixture); assert.isFalse( @@ -492,7 +492,7 @@ describe('color-contrast-matches', function () { it("should look at the correct root node for a disabled control's label associated w/ aria-labelledby", function () { fixture.innerHTML = '
      ' + '' + '
      '; - var shadowRoot = document + let shadowRoot = document .getElementById('parent') .attachShadow({ mode: 'open' }); shadowRoot.innerHTML = @@ -501,7 +501,7 @@ describe('color-contrast-matches', function () { '' + ''; - var shadowLabel = + let shadowLabel = fixture.firstChild.shadowRoot.querySelector('#shadowLabel'); axe.testUtils.flatTreeSetup(fixture); assert.isFalse( @@ -512,11 +512,11 @@ describe('color-contrast-matches', function () { it('should handle input/label spread across the shadow boundary', function () { fixture.innerHTML = ''; - var container = document.getElementById('firstChild'); - var shadowRoot = container.attachShadow({ mode: 'open' }); + let container = document.getElementById('firstChild'); + let shadowRoot = container.attachShadow({ mode: 'open' }); shadowRoot.innerHTML = ''; - var shadowTarget = container.shadowRoot.querySelector('#input'); + let shadowTarget = container.shadowRoot.querySelector('#input'); axe.testUtils.flatTreeSetup(fixture); assert.isFalse( rule.matches(shadowTarget, axe.utils.getNodeFromTree(shadowTarget)) @@ -529,14 +529,14 @@ describe('color-contrast-matches', function () { '
      ' + ''; - var shadowRoot = document + let shadowRoot = document .getElementById('firstChild') .attachShadow({ mode: 'open' }); shadowRoot.innerHTML = 'Some text' + '

      Other text

      '; - var firstChild = fixture.querySelector('#firstChild'); + let firstChild = fixture.querySelector('#firstChild'); axe.testUtils.flatTreeSetup(fixture); assert.isTrue( rule.matches(firstChild, axe.utils.getNodeFromTree(firstChild)) @@ -550,16 +550,16 @@ describe('color-contrast-matches', function () { ''; function createContentSlotted() { - var group = document.createElement('span'); + let group = document.createElement('span'); group.innerHTML = ''; return group; } - var slotted = fixture.querySelector('.slotted'); - var shadowRoot = slotted.attachShadow({ mode: 'open' }); + let slotted = fixture.querySelector('.slotted'); + let shadowRoot = slotted.attachShadow({ mode: 'open' }); shadowRoot.appendChild(createContentSlotted()); - var input = slotted.querySelector('input'); + let input = slotted.querySelector('input'); axe.testUtils.flatTreeSetup(fixture); assert.isTrue(rule.matches(input, axe.utils.getNodeFromTree(input))); }); diff --git a/test/rule-matches/data-table-matches.js b/test/rule-matches/data-table-matches.js index ab1e92523f..b1ebe50e4a 100644 --- a/test/rule-matches/data-table-matches.js +++ b/test/rule-matches/data-table-matches.js @@ -1,9 +1,9 @@ describe('data-table-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let fixture = document.getElementById('fixture'); + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('th-has-data-cells'); @@ -25,7 +25,7 @@ describe('data-table-matches', function () { '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -37,7 +37,7 @@ describe('data-table-matches', function () { '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -50,7 +50,7 @@ describe('data-table-matches', function () { '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'table')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); }); diff --git a/test/rule-matches/duplicate-id-active-matches.js b/test/rule-matches/duplicate-id-active-matches.js index 60bb45d3c6..3ca24ef812 100644 --- a/test/rule-matches/duplicate-id-active-matches.js +++ b/test/rule-matches/duplicate-id-active-matches.js @@ -1,9 +1,9 @@ describe('duplicate-id-active matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let fixture = document.getElementById('fixture'); + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('duplicate-id-active'); @@ -19,31 +19,31 @@ describe('duplicate-id-active matches', function () { it('returns false if the ID is of an inactive non-referenced element', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an inactive non-referenced element with a duplicate', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns true if the ID is of an active non-referenced element', function () { fixtureSetup(''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns true if the ID is a duplicate of an active non-referenced element', function () { fixtureSetup('
      ' + ''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an inactive ARIA referenced element', function () { fixtureSetup('
      ' + '
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -53,7 +53,7 @@ describe('duplicate-id-active matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -61,7 +61,7 @@ describe('duplicate-id-active matches', function () { fixtureSetup( '' + '
      ' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -71,7 +71,7 @@ describe('duplicate-id-active matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); }); diff --git a/test/rule-matches/duplicate-id-aria-matches.js b/test/rule-matches/duplicate-id-aria-matches.js index 2ebd3a0714..1dd2e0bea9 100644 --- a/test/rule-matches/duplicate-id-aria-matches.js +++ b/test/rule-matches/duplicate-id-aria-matches.js @@ -1,9 +1,9 @@ describe('duplicate-id-aria matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let fixture = document.getElementById('fixture'); + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('duplicate-id-aria'); @@ -19,31 +19,31 @@ describe('duplicate-id-aria matches', function () { it('returns false if the ID is of an inactive non-referenced element', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an inactive non-referenced element with a duplicate', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an active non-referenced element', function () { fixtureSetup(''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is a duplicate of an active non-referenced element', function () { fixtureSetup('
      ' + ''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns true if the ID is of an inactive ARIA referenced element', function () { fixtureSetup('
      ' + '
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); @@ -53,7 +53,7 @@ describe('duplicate-id-aria matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); @@ -61,7 +61,7 @@ describe('duplicate-id-aria matches', function () { fixtureSetup( '' + '
      ' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); @@ -71,7 +71,7 @@ describe('duplicate-id-aria matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); }); diff --git a/test/rule-matches/duplicate-id-misc-matches.js b/test/rule-matches/duplicate-id-misc-matches.js index 77f2331b22..0ed71c10e2 100644 --- a/test/rule-matches/duplicate-id-misc-matches.js +++ b/test/rule-matches/duplicate-id-misc-matches.js @@ -1,9 +1,9 @@ describe('duplicate-id-misc matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let fixture = document.getElementById('fixture'); + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('duplicate-id'); @@ -19,31 +19,31 @@ describe('duplicate-id-misc matches', function () { it('returns true if the ID is of an inactive non-referenced element', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns true if the ID is of an inactive non-referenced element with a duplicate', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an active non-referenced element', function () { fixtureSetup(''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is a duplicate of an active non-referenced element', function () { fixtureSetup('
      ' + ''); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); it('returns false if the ID is of an inactive ARIA referenced element', function () { fixtureSetup('
      ' + '
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'div[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -53,7 +53,7 @@ describe('duplicate-id-misc matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -61,7 +61,7 @@ describe('duplicate-id-misc matches', function () { fixtureSetup( '' + '
      ' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'button[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -71,7 +71,7 @@ describe('duplicate-id-misc matches', function () { '
      ' + '' ); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'span[id=foo]')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); }); diff --git a/test/rule-matches/frame-focusable-content-matches.js b/test/rule-matches/frame-focusable-content-matches.js index 8adc9ef5b7..c3e017fbfc 100644 --- a/test/rule-matches/frame-focusable-content-matches.js +++ b/test/rule-matches/frame-focusable-content-matches.js @@ -1,13 +1,13 @@ describe('frame-focusable-content-matches', function () { 'use strict'; - var rule; + let rule; beforeEach(function () { rule = axe.utils.getRule('frame-focusable-content'); }); it('returns false for the top-level context', function () { - var result = rule.matches(null, null, { + let result = rule.matches(null, null, { initiator: true, focusable: false, size: { @@ -19,7 +19,7 @@ describe('frame-focusable-content-matches', function () { }); it('returns false for focusable iframes', function () { - var result = rule.matches(null, null, { + let result = rule.matches(null, null, { initiator: false, focusable: true, size: { @@ -31,7 +31,7 @@ describe('frame-focusable-content-matches', function () { }); it('returns false for non-focusable iframes that are too small (1x1)', function () { - var result = rule.matches(null, null, { + let result = rule.matches(null, null, { initiator: false, focusable: false, size: { @@ -43,7 +43,7 @@ describe('frame-focusable-content-matches', function () { }); it('returns false for non-focusable iframes that are too small (0x0)', function () { - var result = rule.matches(null, null, { + let result = rule.matches(null, null, { initiator: false, focusable: false, size: { @@ -55,7 +55,7 @@ describe('frame-focusable-content-matches', function () { }); it('returns true for non-focusable iframes', function () { - var result = rule.matches(null, null, { + let result = rule.matches(null, null, { initiator: false, focusable: false, size: { diff --git a/test/rule-matches/frame-title-has-text-matches.js b/test/rule-matches/frame-title-has-text-matches.js index cb9bbe42fc..da8f3a6ef9 100644 --- a/test/rule-matches/frame-title-has-text-matches.js +++ b/test/rule-matches/frame-title-has-text-matches.js @@ -1,8 +1,8 @@ describe('layout-table-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var rule; + let fixture = document.getElementById('fixture'); + let rule; beforeEach(function () { rule = axe.utils.getRule('frame-title-unique'); @@ -14,19 +14,19 @@ describe('layout-table-matches', function () { it('should return true if title attribute has text', function () { fixture.innerHTML = ''; - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isTrue(rule.matches(node)); }); it('should return false if title attribute is empty', function () { fixture.innerHTML = ''; - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); it('should return false if title attribute contains only whitespace', function () { fixture.innerHTML = ''; - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); }); diff --git a/test/rule-matches/has-implicit-chromium-role-matches.js b/test/rule-matches/has-implicit-chromium-role-matches.js index 55c54807c0..1e2ffd91c2 100644 --- a/test/rule-matches/has-implicit-chromium-role-matches.js +++ b/test/rule-matches/has-implicit-chromium-role-matches.js @@ -1,9 +1,9 @@ describe('has-implicit-chromium-role-matches', function () { 'use strict'; - var rule; - var fixture = document.getElementById('fixture'); - var queryFixture = axe.testUtils.queryFixture; + let rule; + let fixture = document.getElementById('fixture'); + let queryFixture = axe.testUtils.queryFixture; beforeEach(function () { rule = axe.utils.getRule('presentation-role-conflict'); @@ -18,22 +18,22 @@ describe('has-implicit-chromium-role-matches', function () { }); it('matches elements with an implicit role', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isTrue(rule.matches(null, vNode)); }); it('does not match elements with no implicit role', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isFalse(rule.matches(null, vNode)); }); it('matches elements with an implicit role in chromium', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); }); it('does not match elements with no implicit role even if they are focusable and have an explicit role', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      ' ); assert.isFalse(rule.matches(null, vNode)); diff --git a/test/rule-matches/heading-matches.js b/test/rule-matches/heading-matches.js index 4939f16b9f..b4bc102048 100644 --- a/test/rule-matches/heading-matches.js +++ b/test/rule-matches/heading-matches.js @@ -1,8 +1,8 @@ describe('heading-matches', function () { 'use strict'; - var queryFixture = axe.testUtils.queryFixture; - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; + let queryFixture = axe.testUtils.queryFixture; + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('empty-heading'); @@ -13,39 +13,39 @@ describe('heading-matches', function () { }); it('should return false on elements that are not headings', function () { - var vNode = fixtureSetup('
      '); + let vNode = fixtureSetup('
      '); assert.isFalse(rule.matches(null, vNode)); }); it('should return true on elements with role="heading"', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isTrue(rule.matches(null, vNode)); }); it('should return true on regular headings without roles', function () { - for (var i = 1; i <= 6; i++) { - var vNode = queryFixture(''); + for (let i = 1; i <= 6; i++) { + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); } }); it('should return false on headings with their role changes', function () { - var vNode = queryFixture('

      '); + let vNode = queryFixture('

      '); assert.isFalse(rule.matches(null, vNode)); }); it('should return true on headings with their role changes to an invalid role', function () { - var vNode = queryFixture('

      '); + let vNode = queryFixture('

      '); assert.isTrue(rule.matches(null, vNode)); }); it('should return true on headings with their role changes to an abstract role', function () { - var vNode = queryFixture('

      '); + let vNode = queryFixture('

      '); assert.isTrue(rule.matches(null, vNode)); }); it('should return true on headings with explicit role="none" and an empty aria-label to account for presentation conflict resolution', function () { - var vNode = queryFixture('

      '); + let vNode = queryFixture('

      '); assert.isTrue(rule.matches(null, vNode)); }); }); diff --git a/test/rule-matches/html-namespace-matches.js b/test/rule-matches/html-namespace-matches.js index 48ff0a2667..16f08a3524 100644 --- a/test/rule-matches/html-namespace-matches.js +++ b/test/rule-matches/html-namespace-matches.js @@ -1,8 +1,8 @@ describe('html-namespace-matches', function () { 'use strict'; - var rule; - var fixture; - var axeFixtureSetup; + let rule; + let fixture; + let axeFixtureSetup; beforeEach(function () { fixture = document.getElementById('fixture'); @@ -16,22 +16,22 @@ describe('html-namespace-matches', function () { it('returns true when passed an HTML element', function () { axeFixtureSetup('

      Hello world

      '); - var node = fixture.querySelector('h1'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector('h1'); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isTrue(rule.matches(node, virtualNode)); }); it('returns true when passed a custom HTML element', function () { axeFixtureSetup('Hello world'); - var node = fixture.querySelector('xx-heading'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector('xx-heading'); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isTrue(rule.matches(node, virtualNode)); }); it('returns false when passed an SVG element', function () { axeFixtureSetup('Pretty picture'); - var node = fixture.querySelector('svg'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector('svg'); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); }); @@ -39,14 +39,14 @@ describe('html-namespace-matches', function () { axeFixtureSetup( 'Pretty picture' ); - var node = fixture.querySelector('circle'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector('circle'); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); }); describe('Serial Virtual Node', function () { it('returns true when passed an HTML element', function () { - var serialNode = new axe.SerialVirtualNode({ + let serialNode = new axe.SerialVirtualNode({ nodeName: 'h1' }); serialNode.parent = null; @@ -55,7 +55,7 @@ describe('html-namespace-matches', function () { }); it('returns true when passed a custom HTML element', function () { - var serialNode = new axe.SerialVirtualNode({ + let serialNode = new axe.SerialVirtualNode({ nodeName: 'xx-heading' }); serialNode.parent = null; @@ -64,10 +64,10 @@ describe('html-namespace-matches', function () { }); it('returns false when passed an SVG circle element', function () { - var serialNode = new axe.SerialVirtualNode({ + let serialNode = new axe.SerialVirtualNode({ nodeName: 'circle' }); - var parent = new axe.SerialVirtualNode({ + let parent = new axe.SerialVirtualNode({ nodeName: 'svg' }); serialNode.parent = parent; diff --git a/test/rule-matches/html-xml-lang-mismatch.js b/test/rule-matches/html-xml-lang-mismatch.js index b710aef5ca..a369e3b29b 100644 --- a/test/rule-matches/html-xml-lang-mismatch.js +++ b/test/rule-matches/html-xml-lang-mismatch.js @@ -3,9 +3,9 @@ describe('xml-lang-mismatch-matches', function () { // nested this on a per rule basis, for future-proofing writing tests for multiple rules using the same matches describe('for rule: html-xml-lang-mismatch', function () { - var rule; - var dom; - var fixture = document.getElementById('fixture'); + let rule; + let dom; + let fixture = document.getElementById('fixture'); beforeEach(function () { rule = axe.utils.getRule('html-xml-lang-mismatch'); @@ -17,33 +17,33 @@ describe('xml-lang-mismatch-matches', function () { }); it('is a function', function () { - var actual = rule.matches; + let actual = rule.matches; assert.isFunction(actual); }); it('returns false if the element does not contain lang or xml:lang attribute', function () { - var actual = rule.matches(dom); + let actual = rule.matches(dom); assert.isFalse(actual); }); it('returns false if the element contains either/ only one of the lang or xml:lang attribute', function () { dom.setAttribute('lang', 'nl'); - var actual = rule.matches(dom); + let actual = rule.matches(dom); assert.isFalse(actual); }); it('returns true if the element contains both lang and xml:lang attribute', function () { dom.setAttribute('lang', 'en'); dom.setAttribute('xml:lang', 'nl'); - var actual = rule.matches(dom); + let actual = rule.matches(dom); assert.isTrue(actual); }); it('returns false for element of type that is not HTML', function () { - var node = document.createElement('svg'); + let node = document.createElement('svg'); node.setAttribute('lang', ''); node.setAttribute('xml:lang', 'nl'); - var actual = rule.matches(node); + let actual = rule.matches(node); assert.isFalse(actual); }); }); diff --git a/test/rule-matches/identical-links-same-purpose-matches.js b/test/rule-matches/identical-links-same-purpose-matches.js index 9aa044bd08..db6160ea5e 100644 --- a/test/rule-matches/identical-links-same-purpose-matches.js +++ b/test/rule-matches/identical-links-same-purpose-matches.js @@ -1,9 +1,9 @@ describe('identical-links-same-purpose-matches tests', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var queryFixture = axe.testUtils.queryFixture; - var rule = axe.utils.getRule('identical-links-same-purpose'); + let fixture = document.getElementById('fixture'); + let queryFixture = axe.testUtils.queryFixture; + let rule = axe.utils.getRule('identical-links-same-purpose'); afterEach(function () { fixture.innerHTML = ''; @@ -11,79 +11,79 @@ describe('identical-links-same-purpose-matches tests', function () { }); it('returns false when native link without accessible name', function () { - var vNode = queryFixture(''); - var actual = rule.matches(vNode.actualNode, vNode); + let vNode = queryFixture(''); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for ARIA link without accessible name', function () { - var vNode = queryFixture(''); - var actual = rule.matches(vNode.actualNode, vNode); + let vNode = queryFixture(''); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for native link with a role !== link', function () { - var vNode = queryFixture( + let vNode = queryFixture( 'Go to Checkout' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false when `area` has no parent `map` element', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false when `area` has parent `map` that is not referred by `img[usemap]`', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' + '' + '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns true when native link without href', function () { - var vNode = queryFixture('Book Now'); - var actual = rule.matches(vNode.actualNode, vNode); + let vNode = queryFixture('Book Now'); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true when ARIA link without href', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true when native link has an accessible name', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true for ARIA link has an accessible name', function () { - var vNode = queryFixture('Book Tour'); - var actual = rule.matches(vNode.actualNode, vNode); + let vNode = queryFixture('Book Tour'); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true when `area` has parent `map` that is referred by `img`', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' + '' + '' + 'MDN infographic' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); }); diff --git a/test/rule-matches/inserted-into-focus-order-matches.js b/test/rule-matches/inserted-into-focus-order-matches.js index f9a56f3ed2..f7c0697a67 100644 --- a/test/rule-matches/inserted-into-focus-order-matches.js +++ b/test/rule-matches/inserted-into-focus-order-matches.js @@ -1,9 +1,9 @@ describe('inserted-into-focus-order-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var flatTreeSetup = axe.testUtils.flatTreeSetup; - var rule; + let fixture = document.getElementById('fixture'); + let flatTreeSetup = axe.testUtils.flatTreeSetup; + let rule; beforeEach(function () { rule = axe.utils.getRule('focus-order-semantics'); @@ -16,35 +16,35 @@ describe('inserted-into-focus-order-matches', function () { it('should return true for a non-focusable element with tabindex > -1', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isTrue(rule.matches(node)); }); it('should return false for a non-focusable element with tabindex == -1', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); it('should return false for a native focusable element with tabindex > 0', function () { fixture.innerHTML = ''; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); it('should return false for a native focusable element with no tabindex', function () { fixture.innerHTML = ''; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); it('should return false for non-numeric tabindex value', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); }); diff --git a/test/rule-matches/is-initiator-matches.js b/test/rule-matches/is-initiator-matches.js index 8007f1f56a..26d9cf0540 100644 --- a/test/rule-matches/is-initiator-matches.js +++ b/test/rule-matches/is-initiator-matches.js @@ -1,14 +1,14 @@ describe('is-initiator-matches', function () { 'use strict'; - var rule; + let rule; beforeEach(function () { rule = axe.utils.getRule('html-has-lang'); }); afterEach(function () { - var fixture = document.getElementById('fixture'); + let fixture = document.getElementById('fixture'); fixture.innerHTML = ''; }); diff --git a/test/rule-matches/is-visible-matches.js b/test/rule-matches/is-visible-matches.js index 847b796c25..b860986843 100644 --- a/test/rule-matches/is-visible-matches.js +++ b/test/rule-matches/is-visible-matches.js @@ -1,12 +1,12 @@ describe('is-visible-matches', function () { 'use strict'; - var isVisibleMatches = + let isVisibleMatches = axe._thisWillBeDeletedDoNotUse.base.metadataFunctionMap[ 'is-visible-matches' ]; - var fixture = document.getElementById('fixture'); - var fixtureSetup = axe.testUtils.fixtureSetup; + let fixture = document.getElementById('fixture'); + let fixtureSetup = axe.testUtils.fixtureSetup; it('returns true for visible elements', function () { fixtureSetup('

      Hello world

      '); diff --git a/test/rule-matches/label-content-name-mismatch-matches.js b/test/rule-matches/label-content-name-mismatch-matches.js index b47d2847d1..f4ec1c358e 100644 --- a/test/rule-matches/label-content-name-mismatch-matches.js +++ b/test/rule-matches/label-content-name-mismatch-matches.js @@ -1,9 +1,9 @@ describe('label-content-name-mismatch-matches tests', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var queryFixture = axe.testUtils.queryFixture; - var rule = axe.utils.getRule('label-content-name-mismatch'); + let fixture = document.getElementById('fixture'); + let queryFixture = axe.testUtils.queryFixture; + let rule = axe.utils.getRule('label-content-name-mismatch'); afterEach(function () { fixture.innerHTML = ''; @@ -11,145 +11,145 @@ describe('label-content-name-mismatch-matches tests', function () { }); it('returns false if given element has no role', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false if element role is not supported with name from contents', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      20 %
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false if implicit element role is overridden to a role that does not support name from contents', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      Status message
      ' + '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false if element does not have accessible name attributes (`aria-label` or `aria-labelledby`)', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false if element has empty accessible name via `aria-label`', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns true if element has accessible name via `aria-label`', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true if element has accessible name via `aria-labelledby`', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      some content
      ' + '
      Foo text
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns false if element has empty accessible name (`aria-labelledby`)', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      some content
      ' + '
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false if element has empty accessible name (`aria-labelledby`) because idref does not exist', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      some content
      ' + '
      Right Label
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns true if element has accessible name (`aria-labelledby`) - multiple refs', function () { - var vNode = queryFixture( + let vNode = queryFixture( '
      some content
      ' + '
      Foo
      ' + '
      Bar
      ' + '
      Baz
      ' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns false for non-widget role', function () { - var vNode = queryFixture( + let vNode = queryFixture( 'Content Information' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for non-widget role that does support name from content', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for empty text content', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for non text content', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns false for hidden (non visible) text content', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isFalse(actual); }); it('returns true when visible text is combination of alphanumeric and emoji characters', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); it('returns true when visible text is combination of alphanumeric and punctuation characters', function () { - var vNode = queryFixture( + let vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + let actual = rule.matches(vNode.actualNode, vNode); assert.isTrue(actual); }); }); diff --git a/test/rule-matches/label-matches.js b/test/rule-matches/label-matches.js index 8dbdc304db..08f5aaaf9f 100644 --- a/test/rule-matches/label-matches.js +++ b/test/rule-matches/label-matches.js @@ -1,9 +1,9 @@ describe('label-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var queryFixture = axe.testUtils.queryFixture; - var rule; + let fixture = document.getElementById('fixture'); + let queryFixture = axe.testUtils.queryFixture; + let rule; beforeEach(function () { fixture.innerHTML = ''; @@ -11,25 +11,25 @@ describe('label-matches', function () { }); it('returns true for non-input elements', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); }); it('returns true for input elements without type', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); }); it('returns false for input buttons', function () { ['button', 'submit', 'image', 'reset'].forEach(function (type) { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isFalse(rule.matches(null, vNode)); }); }); it('returns false for input elements type=hidden', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isFalse(rule.matches(null, vNode)); }); @@ -37,7 +37,7 @@ describe('label-matches', function () { it('returns true for other input types', function () { ['text', 'password', 'url', 'range', 'date', 'checkbox', 'radio'].forEach( function (type) { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); } ); diff --git a/test/rule-matches/landmark-has-body-context.js b/test/rule-matches/landmark-has-body-context.js index 124ba3dc9e..ce0c865659 100644 --- a/test/rule-matches/landmark-has-body-context.js +++ b/test/rule-matches/landmark-has-body-context.js @@ -1,8 +1,8 @@ describe('landmark-has-body-context', function () { 'use strict'; - var fixtureSetup = axe.testUtils.fixtureSetup; - var rule; - var shadowSupport = axe.testUtils.shadowSupport.v1; + let fixtureSetup = axe.testUtils.fixtureSetup; + let rule; + let shadowSupport = axe.testUtils.shadowSupport.v1; beforeEach(function () { rule = axe.utils.getRule('landmark-banner-is-top-level'); @@ -11,21 +11,21 @@ describe('landmark-has-body-context', function () { it('returns true for elements with a role', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns true for elements not contained in a landmark', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); it('returns false for elements contained in a landmark', function () { fixtureSetup('
      '); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); }); @@ -35,12 +35,12 @@ describe('landmark-has-body-context', function () { // Safari has a bug in 12.0 that throws an error when calling // attachShadow on
      // @see https://bugs.webkit.org/show_bug.cgi?id=197726 - var article = document.createElement('article'); - var shadow = article.attachShadow({ mode: 'open' }); + let article = document.createElement('article'); + let shadow = article.attachShadow({ mode: 'open' }); shadow.innerHTML = '
      '; fixtureSetup(article); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; assert.isFalse(rule.matches(vNode.actualNode, vNode)); } ); diff --git a/test/rule-matches/landmark-unique-matches.js b/test/rule-matches/landmark-unique-matches.js index 518763d953..8a14fda8d5 100644 --- a/test/rule-matches/landmark-unique-matches.js +++ b/test/rule-matches/landmark-unique-matches.js @@ -1,13 +1,17 @@ describe('landmark-unique-matches', function () { 'use strict'; - var rule; - var fixture; - var axeFixtureSetup; - var shadowSupport = axe.testUtils.shadowSupport.v1; - var sectioningContentElements = ['article', 'aside', 'nav', 'section']; - var excludedDescendantsForHeadersFooters = - sectioningContentElements.concat('main'); - var headerFooterElements = ['header', 'footer']; + let rule; + let fixture; + let axeFixtureSetup; + let shadowSupport = axe.testUtils.shadowSupport.v1; + let excludedDescendantsForHeadersFooters = [ + 'article', + 'aside', + 'main', + 'nav', + 'section' + ]; + let headerFooterElements = ['header', 'footer']; beforeEach(function () { fixture = document.getElementById('fixture'); @@ -17,30 +21,30 @@ describe('landmark-unique-matches', function () { it('should not match because not a landmark', function () { axeFixtureSetup('

      some heading

      '); - var node = fixture.querySelector('h1'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector('h1'); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); }); it('should pass because is a landmark', function () { axeFixtureSetup('
      some banner
      '); - var node = fixture.querySelector('div'); + let node = fixture.querySelector('div'); fixture.appendChild(node); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isTrue(rule.matches(node, virtualNode)); }); it('should not match because landmark is hidden', function () { axeFixtureSetup('
      some banner
      '); - var node = fixture.querySelector('div'); + let node = fixture.querySelector('div'); node.style.display = 'none'; fixture.appendChild(node); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); }); describe('form and section elements must have accessible names to be matched', function () { - var sectionFormElements = ['section', 'form']; + let sectionFormElements = ['section', 'form']; sectionFormElements.forEach(function (elementType) { it( @@ -55,8 +59,8 @@ describe('landmark-unique-matches', function () { elementType + '>' ); - var node = fixture.querySelector(elementType); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector(elementType); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isTrue(rule.matches(node, virtualNode)); } ); @@ -73,8 +77,8 @@ describe('landmark-unique-matches', function () { elementType + '>' ); - var node = fixture.querySelector(elementType); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector(elementType); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); } ); @@ -101,8 +105,8 @@ describe('landmark-unique-matches', function () { exclusionType + '>' ); - var node = fixture.querySelector(elementType); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector(elementType); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isFalse(rule.matches(node, virtualNode)); } ); @@ -116,73 +120,28 @@ describe('landmark-unique-matches', function () { axeFixtureSetup( '<' + elementType + '>an element' ); - var node = fixture.querySelector(elementType); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); + let node = fixture.querySelector(elementType); + let virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); assert.isTrue(rule.matches(node, virtualNode)); } ); }); }); - describe('aside should not match when scoped to a sectioning content element unless it has an accessible name', function () { - sectioningContentElements.forEach(function (exclusionType) { - it( - 'should not match because aside is scoped to ' + - exclusionType + - ' and has no label', - function () { - axeFixtureSetup( - '<' + - exclusionType + - '>' - ); - var node = fixture.querySelector('aside[data-test]'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); - assert.isFalse(rule.matches(node, virtualNode)); - } - ); - - it( - 'should match because aside within ' + exclusionType + ' has a label', - function () { - axeFixtureSetup( - '<' + - exclusionType + - '>' - ); - var node = fixture.querySelector('aside[data-test]'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); - assert.isTrue(rule.matches(node, virtualNode)); - } - ); - }); - - it('should match because aside is not scoped to a sectioning content element', function () { - axeFixtureSetup(''); - var node = fixture.querySelector('aside'); - var virtualNode = axe.utils.getNodeFromTree(axe._tree[0], node); - assert.isTrue(rule.matches(node, virtualNode)); - }); - }); - if (shadowSupport) { it('return true for landmarks contained within shadow dom', function () { - var container = document.createElement('div'); - var shadow = container.attachShadow({ mode: 'open' }); + let container = document.createElement('div'); + let shadow = container.attachShadow({ mode: 'open' }); shadow.innerHTML = '
      '; axeFixtureSetup(container); - var vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; + let vNode = axe.utils.querySelectorAll(axe._tree[0], 'footer')[0]; assert.isTrue(rule.matches(vNode.actualNode, vNode)); }); describe('header/footers should only match when not inside the excluded descendants within shadow dom', function () { - var container; - var shadow; + let container; + let shadow; beforeEach(function () { container = document.createElement('div'); @@ -210,7 +169,7 @@ describe('landmark-unique-matches', function () { '>'; axeFixtureSetup(container); - var virtualNode = axe.utils.querySelectorAll( + let virtualNode = axe.utils.querySelectorAll( axe._tree[0], elementType )[0]; @@ -227,7 +186,7 @@ describe('landmark-unique-matches', function () { shadow.innerHTML = '<' + elementType + '>an element'; axeFixtureSetup(container); - var virtualNode = axe.utils.querySelectorAll( + let virtualNode = axe.utils.querySelectorAll( axe._tree[0], elementType )[0]; @@ -236,63 +195,5 @@ describe('landmark-unique-matches', function () { ); }); }); - - describe('aside should match inside shadow dom unless it is both within sectioning content and has no accessible name', function () { - var container; - var shadow; - - beforeEach(function () { - container = document.createElement('div'); - shadow = container.attachShadow({ mode: 'open' }); - }); - - sectioningContentElements.forEach(function (exclusionType) { - it( - 'should not match because aside is scoped to ' + - exclusionType + - ' and has no label', - function () { - shadow.innerHTML = - '<' + - exclusionType + - ' aria-label="sample label">'; - - axeFixtureSetup(container); - var virtualNode = axe.utils.querySelectorAll( - axe._tree[0], - 'aside[data-test]' - )[0]; - assert.isFalse(rule.matches(virtualNode.actualNode, virtualNode)); - } - ); - - it( - 'should match because aside within ' + exclusionType + ' has a label', - function () { - shadow.innerHTML = - '<' + - exclusionType + - '>'; - axeFixtureSetup(container); - var virtualNode = axe.utils.querySelectorAll( - axe._tree[0], - 'aside[data-test]' - )[0]; - assert.isTrue(rule.matches(virtualNode.actualNode, virtualNode)); - } - ); - }); - - it('should match because aside is not scoped to a sectioning content element', function () { - shadow.innerHTML = ''; - axeFixtureSetup(container); - var virtualNode = axe.utils.querySelectorAll(axe._tree[0], 'aside')[0]; - assert.isTrue(rule.matches(virtualNode.actualNode, virtualNode)); - }); - }); } }); diff --git a/test/rule-matches/layout-table-matches.js b/test/rule-matches/layout-table-matches.js index cae2b1ff73..1753c6b952 100644 --- a/test/rule-matches/layout-table-matches.js +++ b/test/rule-matches/layout-table-matches.js @@ -1,9 +1,9 @@ describe('layout-table-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var flatTreeSetup = axe.testUtils.flatTreeSetup; - var rule; + let fixture = document.getElementById('fixture'); + let flatTreeSetup = axe.testUtils.flatTreeSetup; + let rule; beforeEach(function () { axe.configure({ @@ -26,7 +26,7 @@ describe('layout-table-matches', function () { it('should return false for data table', function () { fixture.innerHTML = '
      Hello>
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); @@ -34,7 +34,7 @@ describe('layout-table-matches', function () { it('should return false if the table is focusable', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isFalse(rule.matches(node)); }); @@ -42,7 +42,7 @@ describe('layout-table-matches', function () { it('should return true if table has role=presentation', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isTrue(rule.matches(node)); }); @@ -50,7 +50,7 @@ describe('layout-table-matches', function () { it('should return true if table has role=none', function () { fixture.innerHTML = '
      '; flatTreeSetup(fixture); - var node = fixture.firstChild; + let node = fixture.firstChild; assert.isTrue(rule.matches(node)); }); diff --git a/test/rule-matches/nested-interactive-matches.js b/test/rule-matches/nested-interactive-matches.js index c4bebe5148..40459e500b 100644 --- a/test/rule-matches/nested-interactive-matches.js +++ b/test/rule-matches/nested-interactive-matches.js @@ -1,7 +1,7 @@ describe('nested-interactive-matches', function () { - var fixture = document.querySelector('#fixture'); - var queryFixture = axe.testUtils.queryFixture; - var rule; + let fixture = document.querySelector('#fixture'); + let queryFixture = axe.testUtils.queryFixture; + let rule; beforeEach(function () { rule = axe.utils.getRule('nested-interactive'); @@ -12,22 +12,22 @@ describe('nested-interactive-matches', function () { }); it('should match if element has children presentational', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isTrue(rule.matches(null, vNode)); }); it('should match if aria element has children presentational', function () { - var vNode = queryFixture('
      '); + let vNode = queryFixture('
      '); assert.isTrue(rule.matches(null, vNode)); }); it('should not match if element does not have children presentational', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isFalse(rule.matches(null, vNode)); }); it('should not match if element has no role', function () { - var vNode = queryFixture(''); + let vNode = queryFixture(''); assert.isFalse(rule.matches(null, vNode)); }); }); diff --git a/test/rule-matches/no-autoplay-audio-matches.js b/test/rule-matches/no-autoplay-audio-matches.js index 1769e3e897..0147b0fcd7 100644 --- a/test/rule-matches/no-autoplay-audio-matches.js +++ b/test/rule-matches/no-autoplay-audio-matches.js @@ -1,10 +1,10 @@ describe('no-autoplay-audio-matches', function () { 'use strict'; - var fixture = document.getElementById('fixture'); - var queryFixture = axe.testUtils.queryFixture; - var preloadOptions = { preload: { assets: ['media'] } }; - var rule; + let fixture = document.getElementById('fixture'); + let queryFixture = axe.testUtils.queryFixture; + let preloadOptions = { preload: { assets: ['media'] } }; + let rule; beforeEach(function () { rule = axe.utils.getRule('no-autoplay-audio'); @@ -15,37 +15,37 @@ describe('no-autoplay-audio-matches', function () { }); it('returns false for