From 50e7c23ae98e42fbc729baaa1500223af315a06b Mon Sep 17 00:00:00 2001 From: "Ava (Gaiety)" <165677673+gaiety-deque@users.noreply.github.com> Date: Mon, 17 Jun 2024 06:09:26 -0500 Subject: [PATCH] chore(test/rule-matches): var -> const & let (#4497) For `test/rule-matches` Smaller part of the full vision: https://github.com/dequelabs/axe-core/pull/4444 --- .../rule-matches/aria-allowed-attr-matches.js | 8 +- .../rule-matches/aria-allowed-role-matches.js | 12 +- 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 | 24 +-- test/rule-matches/html-namespace-matches.js | 30 ++-- test/rule-matches/html-xml-lang-mismatch.js | 18 +-- .../identical-links-same-purpose-matches.js | 48 +++--- .../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 | 83 ++++++----- 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 | 36 ++--- .../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, 527 insertions(+), 516 deletions(-) diff --git a/test/rule-matches/aria-allowed-attr-matches.js b/test/rule-matches/aria-allowed-attr-matches.js index 5b7dfb33a6..e4177e0f78 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; + const 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( + const 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(''); + const 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..14769d0d77 100644 --- a/test/rule-matches/aria-allowed-role-matches.js +++ b/test/rule-matches/aria-allowed-role-matches.js @@ -1,27 +1,29 @@ describe('aria-allowed-role-matches', function () { 'use strict'; - var queryFixture = axe.testUtils.queryFixture; - var rule; + const 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( + const vNode = queryFixture( '' ); assert.isFalse(rule.matches(null, vNode)); }); it('return true for input with redundant role', function () { - var vNode = queryFixture(''); + const vNode = queryFixture( + '' + ); assert.isTrue(rule.matches(null, vNode)); }); it('return true for element with valid role', function () { - var vNode = queryFixture('Other text
'; - var firstChild = fixture.querySelector('#firstChild'); + const 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'); + const group = document.createElement('span'); group.innerHTML = '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..7252a98e83 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'); + const fixture = document.getElementById('fixture'); + const queryFixture = axe.testUtils.queryFixture; + const 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( + const vNode = queryFixture( '' ); - var actual = rule.matches(vNode.actualNode, vNode); + const 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( + const vNode = queryFixture( '