From 0f036268cf9dfdc09eb6f0abf6cbe19dc179689f Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 8 Jan 2021 15:50:51 -0500 Subject: [PATCH] Infrastructure: Fix previously excluded ESLint issues (pull #1610) * fix: Remove unused variables in tests * fix: no undefined in test files * fix: ESLint errors in respec-config * fix: ESLint in treeview * fix: ESLint in toolbar files * fix: Unused vars in tabs * fix: unused vars in slider * fix: Unused vars in meter * fix: ESLint issues in menubar * fix: ESLint menu-button files * fix: ESLint listbox examples * fix: Ignore exported link helper * fix: ESLint in landmarks examples * fix: ESLint errors in supporting example JS * fix: ESLint in grid examples * fix: ESLint in feed example * fix: ESLint in disclosure example * fix: ESLint in dialog modal example * fix: ESLint in combobox examples * fix: ESLint in checkbox examples * fix: ESLint in alert example * fix: ESLint in accordion * chore: Remove passing no-console * chore: Allow console in Node scripts * chore: Disallow unused eslint-disable directives --- .eslintrc.json | 105 ------------------ examples/accordion/js/accordion.js | 12 +- examples/alert/js/alert.js | 2 +- examples/checkbox/checkbox-1/js/checkbox.js | 6 +- .../checkbox/checkbox-2/js/checkboxMixed.js | 8 +- .../checkbox-2/js/controlledCheckbox.js | 6 +- examples/combobox/js/combobox-autocomplete.js | 17 ++- examples/combobox/js/combobox-datepicker.js | 4 +- examples/combobox/js/grid-combo-example.js | 2 +- examples/combobox/js/grid-combo.js | 2 +- examples/dialog-modal/js/alertdialog.js | 4 +- examples/dialog-modal/js/dialog.js | 5 +- examples/disclosure/js/disclosureButton.js | 8 +- examples/disclosure/js/disclosureMenu.js | 4 +- examples/feed/js/main.js | 2 + examples/grid/js/dataGrid.js | 5 +- examples/grid/js/dataGrids.js | 8 +- examples/grid/js/layoutGrids.js | 4 +- examples/js/app.js | 3 + examples/js/examples.js | 2 + .../landmarks/js/bootstrap-accessibility-2.js | 4 +- examples/landmarks/js/show.js | 3 + examples/landmarks/js/tabs.js | 2 + examples/link/js/link.js | 2 + examples/listbox/js/listbox-collapsible.js | 2 +- examples/listbox/js/listbox-rearrangeable.js | 2 + examples/listbox/js/listbox-scrollable.js | 4 +- examples/listbox/js/listbox.js | 3 +- .../menu-button-actions-active-descendant.js | 11 +- .../menu-button/js/menu-button-actions.js | 12 +- examples/menu-button/js/menu-button-links.js | 14 +-- examples/menubar/js/menubar-editor.js | 11 +- examples/menubar/js/menubar-navigation.js | 25 ++--- examples/meter/js/meter.js | 6 - examples/slider/js/multithumb-slider.js | 6 +- examples/slider/js/slider.js | 6 +- examples/slider/js/text-slider.js | 6 +- examples/slider/js/vertical-slider.js | 6 +- examples/tabs/tabs-2/js/tabs.js | 19 ---- examples/toolbar/js/FontMenu.js | 9 +- examples/toolbar/js/FontMenuButton.js | 4 +- examples/toolbar/js/FontMenuItem.js | 16 ++- examples/toolbar/js/FormatToolbar.js | 13 ++- examples/toolbar/js/FormatToolbarItem.js | 10 +- examples/treeview/treeview-1/js/tree.js | 2 + examples/treeview/treeview-1/js/treeitem.js | 4 +- examples/treeview/treeview-2/js/treeLinks.js | 2 + .../treeview/treeview-2/js/treeitemLinks.js | 10 +- package.json | 2 +- respec-config.js | 2 + test/index.js | 3 +- test/tests/accordion_accordion.js | 6 - test/tests/combobox_datepicker.js | 28 +---- test/tests/combobox_select-only.js | 2 +- test/tests/dialog-modal_datepicker.js | 22 ---- test/tests/grid_LayoutGrids.js | 12 -- test/tests/grid_dataGrids.js | 4 - test/tests/link_link.js | 2 + .../menu-button_actions-active-descendant.js | 5 +- test/tests/menu-button_actions.js | 8 +- test/tests/menu-button_links.js | 2 +- test/tests/menubar_menubar-editor.js | 4 - test/tests/menubar_menubar-navigation.js | 9 -- test/tests/slider_slider-2.js | 2 - test/tests/tabs_tabs-1.js | 2 +- test/tests/tabs_tabs-2.js | 2 - test/tests/toolbar_toolbar.js | 18 --- test/tests/treegrid_treegrid-1.js | 7 -- test/tests/treeview_treeview-1a.js | 2 - test/tests/treeview_treeview-1b.js | 6 +- test/tests/treeview_treeview-2a.js | 2 - test/tests/treeview_treeview-2b.js | 10 +- test/util/assertAriaDescribedby.js | 1 - test/util/assertDotValue.js | 3 +- test/util/assertHasFocus.js | 3 - test/util/assertTabOrder.js | 2 +- test/util/force-serial.js | 2 +- test/util/report.js | 2 - 78 files changed, 164 insertions(+), 434 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 74ba739f9b..64de637dda 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,111 +39,6 @@ "rules": { "no-console": 0 } - }, - { - "files": [ - "examples/accordion/js/accordion.js", - "examples/alert/js/alert.js", - "examples/checkbox/checkbox-1/js/checkbox.js", - "examples/checkbox/checkbox-2/js/checkboxMixed.js", - "examples/checkbox/checkbox-2/js/controlledCheckbox.js", - "examples/combobox/js/combobox-autocomplete.js", - "examples/combobox/js/combobox-datepicker.js", - "examples/combobox/js/grid-combo-example.js", - "examples/combobox/js/grid-combo.js", - "examples/dialog-modal/js/alertdialog.js", - "examples/dialog-modal/js/dialog.js", - "examples/disclosure/js/disclosureButton.js", - "examples/disclosure/js/disclosureMenu.js", - "examples/grid/js/dataGrid.js", - "examples/grid/js/dataGrids.js", - "examples/grid/js/layoutGrids.js", - "examples/js/examples.js", - "examples/landmarks/js/bootstrap-accessibility-2.js", - "examples/landmarks/js/show.js", - "examples/link/js/link.js", - "examples/listbox/js/listbox-collapsible.js", - "examples/listbox/js/listbox-scrollable.js", - "examples/listbox/js/listbox.js", - "examples/menu-button/js/menu-button-actions-active-descendant.js", - "examples/menu-button/js/menu-button-actions.js", - "examples/menu-button/js/menu-button-links.js", - "examples/menubar/js/menubar-editor.js", - "examples/menubar/js/menubar-navigation.js", - "examples/meter/js/meter.js", - "examples/slider/js/multithumb-slider.js", - "examples/slider/js/slider.js", - "examples/slider/js/text-slider.js", - "examples/slider/js/vertical-slider.js", - "examples/tabs/tabs-2/js/tabs.js", - "examples/toolbar/js/FontMenu.js", - "examples/toolbar/js/FontMenuButton.js", - "examples/toolbar/js/FontMenuItem.js", - "examples/toolbar/js/FormatToolbar.js", - "examples/toolbar/js/FormatToolbarItem.js", - "examples/treeview/treeview-1/js/treeitem.js", - "examples/treeview/treeview-2/js/treeitemLinks.js", - "respec-config.js", - "test/index.js", - "test/tests/accordion_accordion.js", - "test/tests/combobox_datepicker.js", - "test/tests/combobox_select-only.js", - "test/tests/dialog-modal_datepicker.js", - "test/tests/grid_LayoutGrids.js", - "test/tests/grid_dataGrids.js", - "test/tests/menu-button_actions.js", - "test/tests/menu-button_actions-active-descendant.js", - "test/tests/menubar_menubar-editor.js", - "test/tests/menubar_menubar-navigation.js", - "test/tests/slider_slider-2.js", - "test/tests/tabs_tabs-1.js", - "test/tests/tabs_tabs-2.js", - "test/util/assertHasFocus.js", - "test/tests/toolbar_toolbar.js", - "test/tests/treegrid_treegrid-1.js", - "test/tests/treeview_treeview-1a.js", - "test/tests/treeview_treeview-1b.js", - "test/tests/treeview_treeview-2a.js", - "test/tests/treeview_treeview-2b.js", - "test/util/assertAriaDescribedby.js", - "test/util/assertDotValue.js", - "test/util/report.js" - ], - "rules": { - "no-unused-vars": 0 - } - }, - { - "files": [ - "examples/checkbox/checkbox-2/js/checkboxMixed.js", - "examples/combobox/js/grid-combo-example.js", - "examples/combobox/js/grid-combo.js", - "examples/dialog-modal/js/alertdialog.js", - "examples/feed/js/main.js", - "examples/grid/js/dataGrids.js", - "examples/js/app.js", - "examples/landmarks/js/bootstrap-accessibility-2.js", - "examples/landmarks/js/show.js", - "examples/landmarks/js/tabs.js", - "examples/listbox/js/listbox-rearrangeable.js", - "examples/listbox/js/listbox-scrollable.js", - "examples/menubar/js/menubar-editor.js", - "examples/toolbar/js/FontMenu.js", - "examples/toolbar/js/FontMenuButton.js", - "examples/toolbar/js/FormatToolbar.js", - "examples/treeview/treeview-1/js/tree.js", - "examples/treeview/treeview-2/js/treeLinks.js", - "respec-config.js", - "test/tests/link_link.js", - "test/tests/menu-button_actions-active-descendant.js", - "test/tests/menu-button_actions.js", - "test/tests/menu-button_links.js", - "test/util/assertTabOrder.js", - "test/util/force-serial.js" - ], - "rules": { - "no-undef": 0 - } } ] } diff --git a/examples/accordion/js/accordion.js b/examples/accordion/js/accordion.js index e8b8531700..c162b452c5 100644 --- a/examples/accordion/js/accordion.js +++ b/examples/accordion/js/accordion.js @@ -21,9 +21,6 @@ Array.prototype.slice var triggers = Array.prototype.slice.call( accordion.querySelectorAll('.Accordion-trigger') ); - var panels = Array.prototype.slice.call( - accordion.querySelectorAll('.Accordion-panel') - ); accordion.addEventListener('click', function (event) { var target = event.target; @@ -78,11 +75,6 @@ Array.prototype.slice var target = event.target; var key = event.which.toString(); - var isExpanded = target.getAttribute('aria-expanded') == 'true'; - var allowToggle = allowMultiple - ? allowMultiple - : accordion.hasAttribute('data-allow-toggle'); - // 33 = Page Up, 34 = Page Down var ctrlModifier = event.ctrlKey && key.match(/33|34/); @@ -120,11 +112,11 @@ Array.prototype.slice accordion .querySelectorAll('.Accordion-trigger') .forEach(function (trigger) { - trigger.addEventListener('focus', function (event) { + trigger.addEventListener('focus', function () { accordion.classList.add('focus'); }); - trigger.addEventListener('blur', function (event) { + trigger.addEventListener('blur', function () { accordion.classList.remove('focus'); }); }); diff --git a/examples/alert/js/alert.js b/examples/alert/js/alert.js index 6bb39f055b..30e067dfe0 100644 --- a/examples/alert/js/alert.js +++ b/examples/alert/js/alert.js @@ -21,7 +21,7 @@ window.addEventListener('load', function () { * */ -function addAlert(event) { +function addAlert() { var example = document.getElementById('example'); var template = document.getElementById('alert-template').innerHTML; diff --git a/examples/checkbox/checkbox-1/js/checkbox.js b/examples/checkbox/checkbox-1/js/checkbox.js index 092727e974..67faf4024a 100644 --- a/examples/checkbox/checkbox-1/js/checkbox.js +++ b/examples/checkbox/checkbox-1/js/checkbox.js @@ -67,14 +67,14 @@ Checkbox.prototype.handleKeydown = function (event) { } }; -Checkbox.prototype.handleClick = function (event) { +Checkbox.prototype.handleClick = function () { this.toggleCheckbox(); }; -Checkbox.prototype.handleFocus = function (event) { +Checkbox.prototype.handleFocus = function () { this.domNode.classList.add('focus'); }; -Checkbox.prototype.handleBlur = function (event) { +Checkbox.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); }; diff --git a/examples/checkbox/checkbox-2/js/checkboxMixed.js b/examples/checkbox/checkbox-2/js/checkboxMixed.js index d2ca7f9a8f..84698448be 100644 --- a/examples/checkbox/checkbox-2/js/checkboxMixed.js +++ b/examples/checkbox/checkbox-2/js/checkboxMixed.js @@ -8,6 +8,8 @@ * for a menu of links */ +/* global ControlledCheckbox */ + 'use strict'; /* @@ -136,14 +138,14 @@ CheckboxMixed.prototype.handleKeydown = function (event) { } }; -CheckboxMixed.prototype.handleClick = function (event) { +CheckboxMixed.prototype.handleClick = function () { this.toggleCheckboxMixed(); }; -CheckboxMixed.prototype.handleFocus = function (event) { +CheckboxMixed.prototype.handleFocus = function () { this.domNode.classList.add('focus'); }; -CheckboxMixed.prototype.handleBlur = function (event) { +CheckboxMixed.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); }; diff --git a/examples/checkbox/checkbox-2/js/controlledCheckbox.js b/examples/checkbox/checkbox-2/js/controlledCheckbox.js index 347d87ac7d..a8684309a5 100644 --- a/examples/checkbox/checkbox-2/js/controlledCheckbox.js +++ b/examples/checkbox/checkbox-2/js/controlledCheckbox.js @@ -85,14 +85,14 @@ ControlledCheckbox.prototype.setChecked = function (value) { /* EVENT HANDLERS */ -ControlledCheckbox.prototype.handleChange = function (event) { +ControlledCheckbox.prototype.handleChange = function () { this.controller.updateCheckboxMixed(); }; -ControlledCheckbox.prototype.handleKeyup = function (event) { +ControlledCheckbox.prototype.handleKeyup = function () { this.lastState = this.isChecked(); }; -ControlledCheckbox.prototype.handleClick = function (event) { +ControlledCheckbox.prototype.handleClick = function () { this.lastState = this.isChecked(); }; diff --git a/examples/combobox/js/combobox-autocomplete.js b/examples/combobox/js/combobox-autocomplete.js index 6f5eb8e1fa..accda175b9 100644 --- a/examples/combobox/js/combobox-autocomplete.js +++ b/examples/combobox/js/combobox-autocomplete.js @@ -294,7 +294,6 @@ class ComboboxAutocomplete { onComboboxKeyDown(event) { var flag = false, - char = event.key, altKey = event.altKey; if (event.ctrlKey || event.shiftKey) { @@ -492,7 +491,7 @@ class ComboboxAutocomplete { } } - onComboboxClick(event) { + onComboboxClick() { if (this.isOpen()) { this.close(true); } else { @@ -500,7 +499,7 @@ class ComboboxAutocomplete { } } - onComboboxFocus(event) { + onComboboxFocus() { this.filter = this.comboboxNode.value; this.filterOptions(); this.setVisualFocusCombobox(); @@ -508,14 +507,14 @@ class ComboboxAutocomplete { this.setCurrentOptionStyle(null); } - onComboboxBlur(event) { + onComboboxBlur() { this.comboboxHasVisualFocus = false; this.setCurrentOptionStyle(null); this.removeVisualFocusAll(); setTimeout(this.close.bind(this, false), 300); } - onButtonClick(event) { + onButtonClick() { if (this.isOpen()) { this.close(true); } else { @@ -527,11 +526,11 @@ class ComboboxAutocomplete { /* Listbox Events */ - onListboxMouseover(event) { + onListboxMouseover() { this.hasHover = true; } - onListboxMouseout(event) { + onListboxMouseout() { this.hasHover = false; setTimeout(this.close.bind(this, false), 300); } @@ -543,12 +542,12 @@ class ComboboxAutocomplete { this.close(true); } - onOptionMouseover(event) { + onOptionMouseover() { this.hasHover = true; this.open(); } - onOptionMouseout(event) { + onOptionMouseout() { this.hasHover = false; setTimeout(this.close.bind(this, false), 300); } diff --git a/examples/combobox/js/combobox-datepicker.js b/examples/combobox/js/combobox-datepicker.js index 6187e57c01..607e824ba9 100644 --- a/examples/combobox/js/combobox-datepicker.js +++ b/examples/combobox/js/combobox-datepicker.js @@ -754,9 +754,7 @@ class ComboboxDatePicker { } onComboboxKeyDown(event) { - var flag = false, - char = event.key, - altKey = event.altKey; + var flag = false; if (event.ctrlKey || event.shiftKey) { return; diff --git a/examples/combobox/js/grid-combo-example.js b/examples/combobox/js/grid-combo-example.js index 602df92d9f..1f7f9f4b9f 100644 --- a/examples/combobox/js/grid-combo-example.js +++ b/examples/combobox/js/grid-combo-example.js @@ -93,7 +93,7 @@ function searchVeggies(searchString) { * @desc Initialize the combobox examples once the page has loaded */ window.addEventListener('load', function () { - var ex1Combobox = new aria.GridCombobox( + new aria.GridCombobox( document.getElementById('ex1-input'), document.getElementById('ex1-grid'), searchVeggies diff --git a/examples/combobox/js/grid-combo.js b/examples/combobox/js/grid-combo.js index e130aacf9f..fe7de502e6 100644 --- a/examples/combobox/js/grid-combo.js +++ b/examples/combobox/js/grid-combo.js @@ -180,7 +180,7 @@ aria.GridCombobox.prototype.handleInputKeyDown = function (evt) { } }; -aria.GridCombobox.prototype.handleInputFocus = function (evt) { +aria.GridCombobox.prototype.handleInputFocus = function () { this.updateResults(); }; diff --git a/examples/dialog-modal/js/alertdialog.js b/examples/dialog-modal/js/alertdialog.js index 8a21a7d0bc..42723f3970 100644 --- a/examples/dialog-modal/js/alertdialog.js +++ b/examples/dialog-modal/js/alertdialog.js @@ -1,3 +1,5 @@ +/* global closeDialog, openDialog */ + 'use strict'; var aria = aria || {}; @@ -19,7 +21,7 @@ aria.Utils.triggerAlert = function (alertEl, content) { alertEl.classList.remove('hidden'); alertEl.addEventListener( 'transitionend', - function (e) { + function () { if (!this.classList.contains('active')) { this.classList.add('hidden'); } diff --git a/examples/dialog-modal/js/dialog.js b/examples/dialog-modal/js/dialog.js index 0d2242e5eb..8cd95bf7ba 100644 --- a/examples/dialog-modal/js/dialog.js +++ b/examples/dialog-modal/js/dialog.js @@ -276,7 +276,6 @@ aria.Utils = aria.Utils || {}; newFocusAfterClosed, newFocusFirst ) { - var closedDialog = aria.getCurrentDialog(); aria.OpenDialogList.pop(); this.removeListeners(); aria.Utils.remove(this.preNode); @@ -285,7 +284,7 @@ aria.Utils = aria.Utils || {}; this.backdropNode.classList.remove('active'); var focusAfterClosed = newFocusAfterClosed || this.focusAfterClosed; - var dialog = new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst); + new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst); }; // end replace aria.Dialog.prototype.addListeners = function () { @@ -313,7 +312,7 @@ aria.Utils = aria.Utils || {}; }; // end trapFocus window.openDialog = function (dialogId, focusAfterClosed, focusFirst) { - var dialog = new aria.Dialog(dialogId, focusAfterClosed, focusFirst); + new aria.Dialog(dialogId, focusAfterClosed, focusFirst); }; window.closeDialog = function (closeButton) { diff --git a/examples/disclosure/js/disclosureButton.js b/examples/disclosure/js/disclosureButton.js index 67be976a0b..9532095da8 100644 --- a/examples/disclosure/js/disclosureButton.js +++ b/examples/disclosure/js/disclosureButton.js @@ -79,15 +79,15 @@ ButtonExpand.prototype.handleKeydown = function (event) { } }; -ButtonExpand.prototype.handleClick = function (event) { +ButtonExpand.prototype.handleClick = function () { this.toggleExpand(); }; -ButtonExpand.prototype.handleFocus = function (event) { +ButtonExpand.prototype.handleFocus = function () { this.domNode.classList.add('focus'); }; -ButtonExpand.prototype.handleBlur = function (event) { +ButtonExpand.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); }; @@ -95,7 +95,7 @@ ButtonExpand.prototype.handleBlur = function (event) { window.addEventListener( 'load', - function (event) { + function () { var buttons = document.querySelectorAll( 'button[aria-expanded][aria-controls]' ); diff --git a/examples/disclosure/js/disclosureMenu.js b/examples/disclosure/js/disclosureMenu.js index b70914a7d6..d6ec32bae6 100644 --- a/examples/disclosure/js/disclosureMenu.js +++ b/examples/disclosure/js/disclosureMenu.js @@ -164,7 +164,7 @@ DisclosureNav.prototype.updateKeyControls = function (useArrowKeys) { window.addEventListener( 'load', - function (event) { + function () { var menus = document.querySelectorAll('.disclosure-nav'); var disclosureMenus = []; @@ -175,7 +175,7 @@ window.addEventListener( // listen to arrow key checkbox var arrowKeySwitch = document.getElementById('arrow-behavior-switch'); - arrowKeySwitch.addEventListener('change', function (event) { + arrowKeySwitch.addEventListener('change', function () { var checked = arrowKeySwitch.checked; for (var i = 0; i < disclosureMenus.length; i++) { disclosureMenus[i].updateKeyControls(checked); diff --git a/examples/feed/js/main.js b/examples/feed/js/main.js index 3731fc2078..e2e4337ed8 100644 --- a/examples/feed/js/main.js +++ b/examples/feed/js/main.js @@ -3,6 +3,8 @@ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document */ +/* global aria */ + 'use strict'; /** diff --git a/examples/grid/js/dataGrid.js b/examples/grid/js/dataGrid.js index c3e71d44af..0839744f19 100644 --- a/examples/grid/js/dataGrid.js +++ b/examples/grid/js/dataGrid.js @@ -708,7 +708,7 @@ aria.Grid.prototype.restructureGrid = function () { this.gridNode.innerHTML = ''; this.gridNode.append(newRow); - cells.forEach(function (cell, index) { + cells.forEach(function (cell) { var cellWidth = cell.offsetWidth; if (currentWidth > 0 && currentWidth >= gridWidth - cellWidth) { @@ -836,9 +836,6 @@ aria.Grid.prototype.getNextVisibleCell = function (directionX, directionY) { return false; } - var rowCount = this.grid.length; - var colCount = this.grid[nextCell.row].length; - while (this.isHidden(nextCell.row, nextCell.col)) { var currRow = nextCell.row; var currCol = nextCell.col; diff --git a/examples/grid/js/dataGrids.js b/examples/grid/js/dataGrids.js index d2351c4d70..229f84a147 100644 --- a/examples/grid/js/dataGrids.js +++ b/examples/grid/js/dataGrids.js @@ -3,6 +3,8 @@ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document */ +/* global aria */ + 'use strict'; /** @@ -13,17 +15,17 @@ window.addEventListener('load', function () { var ex1 = document.getElementById('ex1'); - var ex1Grid = new aria.Grid(ex1.querySelector('[role="grid"]')); + new aria.Grid(ex1.querySelector('[role="grid"]')); var ex2 = document.getElementById('ex2'); - var ex2Grid = new aria.Grid(ex2.querySelector('[role="grid"]')); + new aria.Grid(ex2.querySelector('[role="grid"]')); var ex3 = document.getElementById('ex3'); var ex3Grid = new aria.Grid(ex3.querySelector('[role="grid"]')); var toggleButton = document.getElementById('toggle_column_btn'); var toggledOn = true; - toggleButton.addEventListener('click', function (event) { + toggleButton.addEventListener('click', function () { toggledOn = !toggledOn; ex3Grid.toggleColumn(2, toggledOn); diff --git a/examples/grid/js/layoutGrids.js b/examples/grid/js/layoutGrids.js index 2c8553e957..13eec4fa09 100644 --- a/examples/grid/js/layoutGrids.js +++ b/examples/grid/js/layoutGrids.js @@ -16,13 +16,13 @@ var aria = aria || {}; window.addEventListener('load', function () { // Setup Example 1 var ex1 = document.getElementById('ex1'); - var ex1Grid = new aria.Grid(ex1.querySelector('[role="grid"]')); + new aria.Grid(ex1.querySelector('[role="grid"]')); // Setup Example 2 var ex2 = document.getElementById('ex2'); var ex2Grid = new aria.Grid(ex2.querySelector('[role="grid"]')); - var pillList = new PillList( + new PillList( ex2Grid, document.getElementById('add-recipient-input'), document.getElementById('add-recipient-button'), diff --git a/examples/js/app.js b/examples/js/app.js index db66a66ebd..bf9991685a 100644 --- a/examples/js/app.js +++ b/examples/js/app.js @@ -1,4 +1,7 @@ +/* global hljs */ + 'use strict'; + (function () { // Load syntax highlighting hljs.initHighlightingOnLoad(); diff --git a/examples/js/examples.js b/examples/js/examples.js index 7f3f857c4d..c8912e4b80 100644 --- a/examples/js/examples.js +++ b/examples/js/examples.js @@ -2,6 +2,8 @@ * @namespace aria */ +/* exported sourceCode */ + 'use strict'; var aria = aria || {}; diff --git a/examples/landmarks/js/bootstrap-accessibility-2.js b/examples/landmarks/js/bootstrap-accessibility-2.js index d2b23e720d..fb869d72e7 100644 --- a/examples/landmarks/js/bootstrap-accessibility-2.js +++ b/examples/landmarks/js/bootstrap-accessibility-2.js @@ -15,9 +15,11 @@ * limitations under the License. */ +/* global $ */ + 'use strict'; // Removes the "tablist" role from bootstrap.js "nav" class objects -$(document).ready(function (e) { +$(document).ready(function () { $('ul.nav-stacked').removeAttr('role'); }); diff --git a/examples/landmarks/js/show.js b/examples/landmarks/js/show.js index 042d41be93..f83dc735bb 100644 --- a/examples/landmarks/js/show.js +++ b/examples/landmarks/js/show.js @@ -15,6 +15,9 @@ * limitations under the License. */ +/* exported showLandmarks, showHeadings */ +/* globals initLandmarks, initHeadings */ + 'use strict'; function showLandmarks(event) { diff --git a/examples/landmarks/js/tabs.js b/examples/landmarks/js/tabs.js index 107be399bf..39e9eb0abf 100644 --- a/examples/landmarks/js/tabs.js +++ b/examples/landmarks/js/tabs.js @@ -15,6 +15,8 @@ * limitations under the License. */ +/* global $ */ + 'use strict'; $('#myTabs a').click(function (e) { diff --git a/examples/link/js/link.js b/examples/link/js/link.js index ecd1eba772..6f807448e7 100644 --- a/examples/link/js/link.js +++ b/examples/link/js/link.js @@ -3,6 +3,8 @@ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document */ +/* exported goToLink */ + 'use strict'; function goToLink(event, url) { diff --git a/examples/listbox/js/listbox-collapsible.js b/examples/listbox/js/listbox-collapsible.js index 157f9fc10c..3a160f23f8 100644 --- a/examples/listbox/js/listbox-collapsible.js +++ b/examples/listbox/js/listbox-collapsible.js @@ -8,7 +8,7 @@ window.addEventListener('load', function () { var button = document.getElementById('exp_button'); var exListbox = new aria.Listbox(document.getElementById('exp_elem_list')); - var listboxButton = new aria.ListboxButton(button, exListbox); + new aria.ListboxButton(button, exListbox); }); var aria = aria || {}; diff --git a/examples/listbox/js/listbox-rearrangeable.js b/examples/listbox/js/listbox-rearrangeable.js index d8b49aa855..8a096498a5 100644 --- a/examples/listbox/js/listbox-rearrangeable.js +++ b/examples/listbox/js/listbox-rearrangeable.js @@ -3,6 +3,8 @@ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document */ +/* global aria */ + 'use strict'; /** diff --git a/examples/listbox/js/listbox-scrollable.js b/examples/listbox/js/listbox-scrollable.js index fd7781e4b5..1dc1ecf2eb 100644 --- a/examples/listbox/js/listbox-scrollable.js +++ b/examples/listbox/js/listbox-scrollable.js @@ -3,6 +3,8 @@ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document */ +/* global aria */ + 'use strict'; /** @@ -12,5 +14,5 @@ */ window.addEventListener('load', function () { - var exListbox = new aria.Listbox(document.getElementById('ss_elem_list')); + new aria.Listbox(document.getElementById('ss_elem_list')); }); diff --git a/examples/listbox/js/listbox.js b/examples/listbox/js/listbox.js index 87c92b7b55..8851e464a1 100644 --- a/examples/listbox/js/listbox.js +++ b/examples/listbox/js/listbox.js @@ -33,7 +33,7 @@ aria.Listbox = function (listboxNode) { this.moveButton = null; this.keysSoFar = ''; this.handleFocusChange = function () {}; - this.handleItemChange = function (event, items) {}; + this.handleItemChange = function () {}; this.registerEvents(); }; @@ -169,7 +169,6 @@ aria.Listbox.prototype.checkKeyPress = function (evt) { this.focusLastItem(); if (this.multiselectable && evt.shiftKey && evt.ctrlKey) { - var startItem = allOptions[this.startRangeIndex]; this.selectRange(this.startRangeIndex, allOptions.length - 1); } break; diff --git a/examples/menu-button/js/menu-button-actions-active-descendant.js b/examples/menu-button/js/menu-button-actions-active-descendant.js index f7c0396b18..35472f1e00 100644 --- a/examples/menu-button/js/menu-button-actions-active-descendant.js +++ b/examples/menu-button/js/menu-button-actions-active-descendant.js @@ -154,7 +154,6 @@ class MenuButtonActionsActiveDescendant { // Popup menu methods openPopup() { - var rect = this.menuNode.getBoundingClientRect(); this.menuNode.style.display = 'block'; this.buttonNode.setAttribute('aria-expanded', 'true'); this.menuNode.focus(); @@ -179,17 +178,16 @@ class MenuButtonActionsActiveDescendant { // Menu event handlers - onFocusin(event) { + onFocusin() { this.domNode.classList.add('focus'); } - onFocusout(event) { + onFocusout() { this.domNode.classList.remove('focus'); } onButtonKeydown(event) { - var tgt = event.currentTarget, - key = event.key, + var key = event.key, flag = false; switch (key) { @@ -236,8 +234,7 @@ class MenuButtonActionsActiveDescendant { } onMenuKeydown(event) { - var tgt = event.currentTarget, - key = event.key, + var key = event.key, flag = false; function isPrintableCharacter(str) { diff --git a/examples/menu-button/js/menu-button-actions.js b/examples/menu-button/js/menu-button-actions.js index 17fd66cecf..7f81486f5f 100644 --- a/examples/menu-button/js/menu-button-actions.js +++ b/examples/menu-button/js/menu-button-actions.js @@ -70,11 +70,11 @@ class MenuButtonActions { }); } - setFocusToFirstMenuitem(currentMenuitem) { + setFocusToFirstMenuitem() { this.setFocusToMenuitem(this.firstMenuitem); } - setFocusToLastMenuitem(currentMenuitem) { + setFocusToLastMenuitem() { this.setFocusToMenuitem(this.lastMenuitem); } @@ -150,7 +150,6 @@ class MenuButtonActions { // Popup menu methods openPopup() { - var rect = this.menuNode.getBoundingClientRect(); this.menuNode.style.display = 'block'; this.buttonNode.setAttribute('aria-expanded', 'true'); } @@ -168,17 +167,16 @@ class MenuButtonActions { // Menu event handlers - onFocusin(event) { + onFocusin() { this.domNode.classList.add('focus'); } - onFocusout(event) { + onFocusout() { this.domNode.classList.remove('focus'); } onButtonKeydown(event) { - var tgt = event.currentTarget, - key = event.key, + var key = event.key, flag = false; switch (key) { diff --git a/examples/menu-button/js/menu-button-links.js b/examples/menu-button/js/menu-button-links.js index 01056c5e1b..90f4146da1 100644 --- a/examples/menu-button/js/menu-button-links.js +++ b/examples/menu-button/js/menu-button-links.js @@ -67,11 +67,11 @@ class MenuButtonLinks { }); } - setFocusToFirstMenuitem(currentMenuitem) { + setFocusToFirstMenuitem() { this.setFocusToMenuitem(this.firstMenuitem); } - setFocusToLastMenuitem(currentMenuitem) { + setFocusToLastMenuitem() { this.setFocusToMenuitem(this.lastMenuitem); } @@ -147,7 +147,6 @@ class MenuButtonLinks { // Popup menu methods openPopup() { - var rect = this.menuNode.getBoundingClientRect(); this.menuNode.style.display = 'block'; this.buttonNode.setAttribute('aria-expanded', 'true'); } @@ -165,17 +164,16 @@ class MenuButtonLinks { // Menu event handlers - onFocusin(event) { + onFocusin() { this.domNode.classList.add('focus'); } - onFocusout(event) { + onFocusout() { this.domNode.classList.remove('focus'); } onButtonKeydown(event) { - var tgt = event.currentTarget, - key = event.key, + var key = event.key, flag = false; switch (key) { @@ -325,6 +323,6 @@ class MenuButtonLinks { window.addEventListener('load', function () { var menuButtons = document.querySelectorAll('.menu-button-links'); for (let i = 0; i < menuButtons.length; i++) { - var menuButton = new MenuButtonLinks(menuButtons[i]); + new MenuButtonLinks(menuButtons[i]); } }); diff --git a/examples/menubar/js/menubar-editor.js b/examples/menubar/js/menubar-editor.js index 905b4ce87a..7a7c9d70dc 100644 --- a/examples/menubar/js/menubar-editor.js +++ b/examples/menubar/js/menubar-editor.js @@ -7,6 +7,8 @@ * Desc: Creates a menubar to control the styling of text in a textarea element */ +/* global StyleManager */ + 'use strict'; var MenubarEditor = function (domNode) { @@ -92,7 +94,7 @@ MenubarEditor.prototype.getMenuitems = function (domNode) { }; MenubarEditor.prototype.initMenu = function (menu) { - var i, menuitems, menuitem, role, nextElement; + var i, menuitems, menuitem, role; var menuId = this.getMenuId(menu); @@ -347,7 +349,6 @@ MenubarEditor.prototype.getMenuId = function (node) { }; MenubarEditor.prototype.getMenu = function (menuitem) { - var id = false; var menu = menuitem; var role = menuitem.getAttribute('role'); @@ -496,11 +497,11 @@ MenubarEditor.prototype.isOpen = function (menuitem) { // Menu event handlers -MenubarEditor.prototype.handleFocusin = function (event) { +MenubarEditor.prototype.handleFocusin = function () { this.domNode.classList.add('focus'); }; -MenubarEditor.prototype.handleFocusout = function (event) { +MenubarEditor.prototype.handleFocusout = function () { this.domNode.classList.remove('focus'); }; @@ -704,6 +705,6 @@ MenubarEditor.prototype.handleMenuitemMouseover = function (event) { window.addEventListener('load', function () { var menubarEditors = document.querySelectorAll('.menubar-editor'); for (var i = 0; i < menubarEditors.length; i++) { - var menubarEditor = new MenubarEditor(menubarEditors[i]); + new MenubarEditor(menubarEditors[i]); } }); diff --git a/examples/menubar/js/menubar-navigation.js b/examples/menubar/js/menubar-navigation.js index ebb2dee4d9..398ae52db6 100644 --- a/examples/menubar/js/menubar-navigation.js +++ b/examples/menubar/js/menubar-navigation.js @@ -39,7 +39,6 @@ MenubarNavigation.prototype.getMenuitems = function (domNode, depth) { var nodes = []; var initMenu = this.initMenu.bind(this); - var menuitemGroups = this.menuitemGroups; var popups = this.popups; function findMenuitems(node) { @@ -89,7 +88,7 @@ MenubarNavigation.prototype.getMenuitems = function (domNode, depth) { }; MenubarNavigation.prototype.initMenu = function (menu, depth) { - var menuitems, menuitem, role, nextElement; + var menuitems, menuitem, role; var menuId = this.getMenuId(menu); @@ -152,17 +151,11 @@ MenubarNavigation.prototype.setFocusToMenuitem = function ( } }; -MenubarNavigation.prototype.setFocusToFirstMenuitem = function ( - menuId, - currentMenuitem -) { +MenubarNavigation.prototype.setFocusToFirstMenuitem = function (menuId) { this.setFocusToMenuitem(menuId, this.firstMenuitem[menuId]); }; -MenubarNavigation.prototype.setFocusToLastMenuitem = function ( - menuId, - currentMenuitem -) { +MenubarNavigation.prototype.setFocusToLastMenuitem = function (menuId) { this.setFocusToMenuitem(menuId, this.lastMenuitem[menuId]); }; @@ -299,7 +292,6 @@ MenubarNavigation.prototype.getMenuId = function (node) { }; MenubarNavigation.prototype.getMenu = function (menuitem) { - var id = false; var menu = menuitem; var role = menuitem.getAttribute('role'); @@ -433,12 +425,12 @@ MenubarNavigation.prototype.hasFocus = function () { // Menu event handlers -MenubarNavigation.prototype.handleMenubarFocusin = function (event) { +MenubarNavigation.prototype.handleMenubarFocusin = function () { // if the menubar or any of its menus has focus, add styling hook for hover this.domNode.classList.add('focus'); }; -MenubarNavigation.prototype.handleMenubarFocusout = function (event) { +MenubarNavigation.prototype.handleMenubarFocusout = function () { // remove styling hook for hover on menubar item this.domNode.classList.remove('focus'); }; @@ -450,10 +442,7 @@ MenubarNavigation.prototype.handleKeydown = function (event) { menuId = this.getMenuId(tgt), id, popupMenuId, - mi, - role, - option, - value; + mi; var isAnyPopupOpen = this.isAnyPopupOpen(); @@ -625,6 +614,6 @@ MenubarNavigation.prototype.handleBackgroundMousedown = function (event) { window.addEventListener('load', function () { var menubarNavs = document.querySelectorAll('.menubar-navigation'); for (var i = 0; i < menubarNavs.length; i++) { - var menubarNav = new MenubarNavigation(menubarNavs[i]); + new MenubarNavigation(menubarNavs[i]); } }); diff --git a/examples/meter/js/meter.js b/examples/meter/js/meter.js index 1eb084dfc1..0370157e16 100644 --- a/examples/meter/js/meter.js +++ b/examples/meter/js/meter.js @@ -76,12 +76,6 @@ Meter.prototype.setValue = function (value) { /* Code for example page */ window.addEventListener('load', function () { - // helper function to randomize example meter value - function getRandomValue(min, max) { - var range = max - min; - return Math.floor(Math.random() * range + min); - } - // init meters var meterEls = document.querySelectorAll('[role=meter]'); var meters = []; diff --git a/examples/slider/js/multithumb-slider.js b/examples/slider/js/multithumb-slider.js index 9f731049da..b71eb2bb82 100644 --- a/examples/slider/js/multithumb-slider.js +++ b/examples/slider/js/multithumb-slider.js @@ -170,12 +170,12 @@ Slider.prototype.handleKeyDown = function (event) { } }; -Slider.prototype.handleFocus = function (event) { +Slider.prototype.handleFocus = function () { this.domNode.classList.add('focus'); this.railDomNode.classList.add('focus'); }; -Slider.prototype.handleBlur = function (event) { +Slider.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); this.railDomNode.classList.remove('focus'); }; @@ -194,7 +194,7 @@ Slider.prototype.handleMouseDown = function (event) { event.stopPropagation(); }; - var handleMouseUp = function (event) { + var handleMouseUp = function () { document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); }; diff --git a/examples/slider/js/slider.js b/examples/slider/js/slider.js index dc5a936ba4..319981ca5f 100644 --- a/examples/slider/js/slider.js +++ b/examples/slider/js/slider.js @@ -154,12 +154,12 @@ Slider.prototype.handleKeyDown = function (event) { } }; -Slider.prototype.handleFocus = function (event) { +Slider.prototype.handleFocus = function () { this.domNode.classList.add('focus'); this.railDomNode.classList.add('focus'); }; -Slider.prototype.handleBlur = function (event) { +Slider.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); this.railDomNode.classList.remove('focus'); }; @@ -188,7 +188,7 @@ Slider.prototype.handleMouseDown = function (event) { event.stopPropagation(); }; - var handleMouseUp = function (event) { + var handleMouseUp = function () { document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); }; diff --git a/examples/slider/js/text-slider.js b/examples/slider/js/text-slider.js index 5fc95ffaee..683e311f93 100644 --- a/examples/slider/js/text-slider.js +++ b/examples/slider/js/text-slider.js @@ -143,12 +143,12 @@ TSlider.prototype.handleKeyDown = function (event) { } }; -TSlider.prototype.handleFocus = function (event) { +TSlider.prototype.handleFocus = function () { this.domNode.classList.add('focus'); this.railDomNode.classList.add('focus'); }; -TSlider.prototype.handleBlur = function (event) { +TSlider.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); this.railDomNode.classList.remove('focus'); }; @@ -167,7 +167,7 @@ TSlider.prototype.handleMouseDown = function (event) { event.stopPropagation(); }; - var handleMouseUp = function (event) { + var handleMouseUp = function () { document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); }; diff --git a/examples/slider/js/vertical-slider.js b/examples/slider/js/vertical-slider.js index a4d337ed76..fedd86a763 100644 --- a/examples/slider/js/vertical-slider.js +++ b/examples/slider/js/vertical-slider.js @@ -154,12 +154,12 @@ VSlider.prototype.handleKeyDown = function (event) { } }; -VSlider.prototype.handleFocus = function (event) { +VSlider.prototype.handleFocus = function () { this.domNode.classList.add('focus'); this.railDomNode.classList.add('focus'); }; -VSlider.prototype.handleBlur = function (event) { +VSlider.prototype.handleBlur = function () { this.domNode.classList.remove('focus'); this.railDomNode.classList.remove('focus'); }; @@ -178,7 +178,7 @@ VSlider.prototype.handleMouseDown = function (event) { event.stopPropagation(); }; - var handleMouseUp = function (event) { + var handleMouseUp = function () { document.removeEventListener('mousemove', handleMouseMove); document.removeEventListener('mouseup', handleMouseUp); }; diff --git a/examples/tabs/tabs-2/js/tabs.js b/examples/tabs/tabs-2/js/tabs.js index 2b3eda488e..8c8d351aaa 100644 --- a/examples/tabs/tabs-2/js/tabs.js +++ b/examples/tabs/tabs-2/js/tabs.js @@ -219,23 +219,4 @@ target.parentElement.removeChild(target); panel.parentElement.removeChild(panel); } - - // Determine whether there should be a delay - // when user navigates with the arrow keys - function determineDelay() { - var hasDelay = tablist.hasAttribute('data-delay'); - var delay = 0; - - if (hasDelay) { - var delayValue = tablist.getAttribute('data-delay'); - if (delayValue) { - delay = delayValue; - } else { - // If no value is specified, default to 300ms - delay = 300; - } - } - - return delay; - } })(); diff --git a/examples/toolbar/js/FontMenu.js b/examples/toolbar/js/FontMenu.js index 75485ae17c..5287404ff7 100644 --- a/examples/toolbar/js/FontMenu.js +++ b/examples/toolbar/js/FontMenu.js @@ -5,11 +5,12 @@ * File: FontMenu.js */ +/* global FontMenuItem */ + 'use strict'; var FontMenu = function (domNode, controllerObj) { - var elementChildren, - msgPrefix = 'FontMenu constructor argument domNode '; + var msgPrefix = 'FontMenu constructor argument domNode '; // Check whether domNode is a DOM element if (!(domNode instanceof Element)) { @@ -88,11 +89,11 @@ FontMenu.prototype.init = function () { /* EVENT HANDLERS */ -FontMenu.prototype.handleMouseover = function (event) { +FontMenu.prototype.handleMouseover = function () { this.hasHover = true; }; -FontMenu.prototype.handleMouseout = function (event) { +FontMenu.prototype.handleMouseout = function () { this.hasHover = false; setTimeout(this.close.bind(this, false), 300); }; diff --git a/examples/toolbar/js/FontMenuButton.js b/examples/toolbar/js/FontMenuButton.js index 30d0d9b431..8a234b6a53 100644 --- a/examples/toolbar/js/FontMenuButton.js +++ b/examples/toolbar/js/FontMenuButton.js @@ -5,6 +5,8 @@ * File: FontMenuButton.js */ +/* global FontMenu */ + 'use strict'; function FontMenuButton(node, toolbar, toolbarItem) { @@ -65,7 +67,7 @@ FontMenuButton.prototype.handleKeyDown = function (event) { } }; -FontMenuButton.prototype.handleClick = function (event, menuButton) { +FontMenuButton.prototype.handleClick = function () { if (this.fontMenu.isOpen()) { this.fontMenu.close(); } else { diff --git a/examples/toolbar/js/FontMenuItem.js b/examples/toolbar/js/FontMenuItem.js index 5fbd8ee4f9..d9d49a5e28 100644 --- a/examples/toolbar/js/FontMenuItem.js +++ b/examples/toolbar/js/FontMenuItem.js @@ -63,10 +63,8 @@ FontMenuItem.prototype.init = function () { /* EVENT HANDLERS */ FontMenuItem.prototype.handleKeydown = function (event) { - var tgt = event.currentTarget, - flag = false, - char = event.key, - clickEvent; + var flag = false, + char = event.key; function isPrintableCharacter(str) { return str.length === 1 && str.match(/\S/); @@ -143,26 +141,26 @@ FontMenuItem.prototype.handleKeydown = function (event) { } }; -FontMenuItem.prototype.handleClick = function (event) { +FontMenuItem.prototype.handleClick = function () { this.fontMenu.setFontFamily(this, this.font); this.fontMenu.setFocusToController(); this.fontMenu.close(true); }; -FontMenuItem.prototype.handleFocus = function (event) { +FontMenuItem.prototype.handleFocus = function () { this.fontMenu.setFocus(); }; -FontMenuItem.prototype.handleBlur = function (event) { +FontMenuItem.prototype.handleBlur = function () { this.fontMenu.removeFocus(); }; -FontMenuItem.prototype.handleMouseover = function (event) { +FontMenuItem.prototype.handleMouseover = function () { this.fontMenu.hasHover = true; this.fontMenu.open(); }; -FontMenuItem.prototype.handleMouseout = function (event) { +FontMenuItem.prototype.handleMouseout = function () { this.fontMenu.hasHover = false; setTimeout(this.fontMenu.close.bind(this.fontMenu, false), 300); }; diff --git a/examples/toolbar/js/FormatToolbar.js b/examples/toolbar/js/FormatToolbar.js index 962514964f..16a559204f 100644 --- a/examples/toolbar/js/FormatToolbar.js +++ b/examples/toolbar/js/FormatToolbar.js @@ -5,6 +5,8 @@ * File: FormatToolbar.js */ +/* global FormatToolbarItem, FontMenuButton, SpinButton */ + 'use strict'; /** @@ -106,8 +108,7 @@ FormatToolbar.prototype.selectTextContent = function () { FormatToolbar.prototype.updateDisable = function ( copyButton, cutButton, - pasteButton, - selectedContent + pasteButton ) { var start = this.textarea.selectionStart; var end = this.textarea.selectionEnd; @@ -131,7 +132,7 @@ FormatToolbar.prototype.selectText = function (start, end, textarea) { return true; } }; -FormatToolbar.prototype.copyTextContent = function (toolbarItem) { +FormatToolbar.prototype.copyTextContent = function () { if (this.copyButton.getAttribute('aria-disabled') === 'true') { return; } @@ -213,7 +214,7 @@ FormatToolbar.prototype.changeFontSize = function (value) { this.textarea.style.fontSize = value + 'pt'; }; -FormatToolbar.prototype.toggleNightMode = function (toolbarItem) { +FormatToolbar.prototype.toggleNightMode = function () { if (this.nightModeCheck.checked) { this.textarea.style.color = '#eee'; this.textarea.style.background = 'black'; @@ -339,11 +340,11 @@ FormatToolbar.prototype.setFocusToPrevious = function (currentItem) { this.setFocusItem(newItem); }; -FormatToolbar.prototype.setFocusToFirst = function (currentItem) { +FormatToolbar.prototype.setFocusToFirst = function () { this.setFocusItem(this.firstItem); }; -FormatToolbar.prototype.setFocusToLast = function (currentItem) { +FormatToolbar.prototype.setFocusToLast = function () { this.setFocusItem(this.lastItem); }; diff --git a/examples/toolbar/js/FormatToolbarItem.js b/examples/toolbar/js/FormatToolbarItem.js index d50d32709d..73f255e963 100644 --- a/examples/toolbar/js/FormatToolbarItem.js +++ b/examples/toolbar/js/FormatToolbarItem.js @@ -159,7 +159,7 @@ FormatToolbarItem.prototype.handleHideAllPopupLabels = function (event) { } }; -FormatToolbarItem.prototype.handleBlur = function (event) { +FormatToolbarItem.prototype.handleBlur = function () { this.toolbar.domNode.classList.remove('focus'); if (this.domNode.classList.contains('nightmode')) { @@ -168,7 +168,7 @@ FormatToolbarItem.prototype.handleBlur = function (event) { this.hidePopupLabel(); }; -FormatToolbarItem.prototype.handleFocus = function (event) { +FormatToolbarItem.prototype.handleFocus = function () { this.toolbar.domNode.classList.add('focus'); if (this.domNode.classList.contains('nightmode')) { @@ -177,12 +177,12 @@ FormatToolbarItem.prototype.handleFocus = function (event) { this.showPopupLabel(); }; -FormatToolbarItem.prototype.handleMouseLeave = function (event) { +FormatToolbarItem.prototype.handleMouseLeave = function () { this.hasHover = false; setTimeout(this.hidePopupLabel.bind(this), this.popupLabelDelay); }; -FormatToolbarItem.prototype.handleMouseOver = function (event) { +FormatToolbarItem.prototype.handleMouseOver = function () { this.showPopupLabel(); this.hasHover = true; }; @@ -256,7 +256,7 @@ FormatToolbarItem.prototype.handleKeyDown = function (event) { } }; -FormatToolbarItem.prototype.handleClick = function (e) { +FormatToolbarItem.prototype.handleClick = function () { if (this.buttonAction == 'link') { return; } diff --git a/examples/treeview/treeview-1/js/tree.js b/examples/treeview/treeview-1/js/tree.js index e55e824188..bac6bc04ca 100644 --- a/examples/treeview/treeview-1/js/tree.js +++ b/examples/treeview/treeview-1/js/tree.js @@ -8,6 +8,8 @@ * for a tree being used as a file viewer */ +/* global Treeitem */ + 'use strict'; /** diff --git a/examples/treeview/treeview-1/js/treeitem.js b/examples/treeview/treeview-1/js/treeitem.js index 84d31d3b74..be5a1ec52e 100644 --- a/examples/treeview/treeview-1/js/treeitem.js +++ b/examples/treeview/treeview-1/js/treeitem.js @@ -222,7 +222,7 @@ Treeitem.prototype.handleClick = function (event) { } }; -Treeitem.prototype.handleFocus = function (event) { +Treeitem.prototype.handleFocus = function () { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; @@ -230,7 +230,7 @@ Treeitem.prototype.handleFocus = function (event) { node.classList.add('focus'); }; -Treeitem.prototype.handleBlur = function (event) { +Treeitem.prototype.handleBlur = function () { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; diff --git a/examples/treeview/treeview-2/js/treeLinks.js b/examples/treeview/treeview-2/js/treeLinks.js index 04aac8e40d..f61c79b06c 100644 --- a/examples/treeview/treeview-2/js/treeLinks.js +++ b/examples/treeview/treeview-2/js/treeLinks.js @@ -8,6 +8,8 @@ * for a tree being used as a file viewer */ +/* global TreeitemLink */ + 'use strict'; /** diff --git a/examples/treeview/treeview-2/js/treeitemLinks.js b/examples/treeview/treeview-2/js/treeitemLinks.js index 674f0adcd1..17471a7fa9 100644 --- a/examples/treeview/treeview-2/js/treeitemLinks.js +++ b/examples/treeview/treeview-2/js/treeitemLinks.js @@ -110,10 +110,8 @@ TreeitemLink.prototype.isExpanded = function () { /* EVENT HANDLERS */ TreeitemLink.prototype.handleKeydown = function (event) { - var tgt = event.currentTarget, - flag = false, - char = event.key, - clickEvent; + var flag = false, + char = event.key; function isPrintableCharacter(str) { return str.length === 1 && str.match(/\S/); @@ -242,7 +240,7 @@ TreeitemLink.prototype.handleClick = function (event) { } }; -TreeitemLink.prototype.handleFocus = function (event) { +TreeitemLink.prototype.handleFocus = function () { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; @@ -250,7 +248,7 @@ TreeitemLink.prototype.handleFocus = function (event) { node.classList.add('focus'); }; -TreeitemLink.prototype.handleBlur = function (event) { +TreeitemLink.prototype.handleBlur = function () { var node = this.domNode; if (this.isExpandable) { node = node.firstElementChild; diff --git a/package.json b/package.json index f95e654ef9..41435f1d06 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "htmlhint": "htmlhint \"**/*.html\" -i \"common/**/*.html\" -f unix", "lint": "npm run lint:es && npm run lint:css && npm run lint:html && npm run lint:spelling", "lint:css": "stylelint **/*.css", - "lint:es": "eslint .", + "lint:es": "eslint . --report-unused-disable-directives", "lint:js": "npm run lint:es", "lint:html": "npm run htmlhint && npm run vnu-jar", "lint:spelling": "cspell \"**/*.*\"", diff --git a/respec-config.js b/respec-config.js index 72255ba293..31677456e9 100644 --- a/respec-config.js +++ b/respec-config.js @@ -1,4 +1,5 @@ 'use strict'; +// eslint-disable-next-line no-unused-vars var respecConfig = { // Specification status (e.g., WD, LC, NOTE, etc.). If in doubt use ED. specStatus: 'ED', @@ -164,5 +165,6 @@ var respecConfig = { // If in doubt ask your friendly neighbourhood Team Contact. wgPatentURI: 'https://www.w3.org/2004/01/pp-impl/83726/status', maxTocLevel: 4, + // eslint-disable-next-line no-undef preProcess: [linkCrossReferences], }; diff --git a/test/index.js b/test/index.js index 01bb7b7142..e3bb41c76a 100644 --- a/test/index.js +++ b/test/index.js @@ -3,7 +3,6 @@ const path = require('path'); const test = require('ava'); const webdriver = require('selenium-webdriver'); -const { By } = require('selenium-webdriver'); const startGeckodriver = require('./util/start-geckodriver'); const queryElement = require('./util/queryElement'); @@ -15,7 +14,7 @@ const testWaitTime = parseInt(process.env.TEST_WAIT_TIME) || 500; const coverageReportRun = process.env.REGRESSION_COVERAGE_REPORT; if (!coverageReportRun) { - test.before(async (t) => { + test.before(async () => { geckodriver = await startGeckodriver(1022, 12 * 1000); session = new webdriver.Builder() .usingServer('http://localhost:' + geckodriver.port) diff --git a/test/tests/accordion_accordion.js b/test/tests/accordion_accordion.js index 59cb266c82..0b1eced61b 100644 --- a/test/tests/accordion_accordion.js +++ b/test/tests/accordion_accordion.js @@ -449,8 +449,6 @@ ariaTest( exampleFile, 'key-down-arrow', async (t) => { - const buttons = await t.context.queryElements(t, ex.buttonSelector); - // Confirm focus moves through remaining items for (let index = 0; index < ex.buttonsInOrder.length - 1; index++) { let itemSelector = ex.buttonsInOrder[index]; @@ -482,8 +480,6 @@ ariaTest( exampleFile, 'key-up-arrow', async (t) => { - const buttons = await t.context.queryElements(t, ex.buttonSelector); - // Confirm focus moves through remaining items for (let index = ex.buttonsInOrder.length - 1; index > 0; index--) { let itemSelector = ex.buttonsInOrder[index]; @@ -519,7 +515,6 @@ ariaTest( exampleFile, 'key-home', async (t) => { - const buttons = await t.context.queryElements(t, ex.buttonSelector); const lastIndex = ex.buttonsInOrder.length - 1; // Confirm focus moves through remaining items @@ -542,7 +537,6 @@ ariaTest( exampleFile, 'key-end', async (t) => { - const buttons = await t.context.queryElements(t, ex.buttonSelector); const lastIndex = ex.buttonsInOrder.length - 1; // Confirm focus moves through remaining items diff --git a/test/tests/combobox_datepicker.js b/test/tests/combobox_datepicker.js index 655e9153ee..838264b2e4 100644 --- a/test/tests/combobox_datepicker.js +++ b/test/tests/combobox_datepicker.js @@ -1,14 +1,10 @@ const { ariaTest } = require('..'); -const { By, Key } = require('selenium-webdriver'); +const { Key } = require('selenium-webdriver'); const assertAttributeValues = require('../util/assertAttributeValues'); const assertAttributeDNE = require('../util/assertAttributeDNE'); -const assertAriaControls = require('../util/assertAriaControls'); const assertAriaLabelledby = require('../util/assertAriaLabelledby'); -const assertAriaDescribedby = require('../util/assertAriaDescribedby'); const assertAriaLabelExists = require('../util/assertAriaLabelExists'); const assertAriaRoles = require('../util/assertAriaRoles'); -const assertRovingTabindex = require('../util/assertRovingTabindex'); -const assertTabOrder = require('../util/assertTabOrder'); const exampleFile = 'combobox/combobox-datepicker.html'; @@ -46,28 +42,6 @@ ex.allFocusableElementsInDialog = [ ex.nextYear, ]; -const clickFirstOfMonth = async function (t) { - let today = new Date(); - today.setUTCHours(0, 0, 0, 0); - - let firstOfMonth = new Date(today); - firstOfMonth.setDate(1); - let firstOfMonthString = today.toISOString().split('T')[0]; - - return ( - await t.context.queryElement(t, `[data-date=${firstOfMonthString}]`) - ).click(); -}; - -const clickToday = async function (t) { - let today = new Date(); - today.setUTCHours(0, 0, 0, 0); - let todayString = today.toISOString().split('T')[0]; - return ( - await t.context.queryElement(t, `[data-date=${todayString}]`) - ).click(); -}; - const setDateToJanFirst2019 = async function (t) { await (await t.context.queryElement(t, ex.comboboxSelector)).click(); return t.context.session.executeScript(function () { diff --git a/test/tests/combobox_select-only.js b/test/tests/combobox_select-only.js index 453954d412..96ecea8d4a 100644 --- a/test/tests/combobox_select-only.js +++ b/test/tests/combobox_select-only.js @@ -1022,7 +1022,7 @@ ariaTest( // type "b" as many times as there are matching options // focus should wrap and end up on second option again - const keys = matchingOps.map((op) => 'b'); + const keys = matchingOps.map(() => 'b'); await combobox.sendKeys(...keys); matchingId = await options[matchingOps[1]].getAttribute('id'); t.is( diff --git a/test/tests/dialog-modal_datepicker.js b/test/tests/dialog-modal_datepicker.js index 7ccf8ef94a..2b473a515e 100644 --- a/test/tests/dialog-modal_datepicker.js +++ b/test/tests/dialog-modal_datepicker.js @@ -44,28 +44,6 @@ const ex = { okButton: '#example [role="dialog"] button[value="ok"]', }; -const clickFirstOfMonth = async function (t) { - let today = new Date(); - today.setUTCHours(0, 0, 0, 0); - - let firstOfMonth = new Date(today); - firstOfMonth.setDate(1); - let firstOfMonthString = today.toISOString().split('T')[0]; - - return t.context.session - .findElement(By.css(`[data-date=${firstOfMonthString}]`)) - .click(); -}; - -const clickToday = async function (t) { - let today = new Date(); - today.setUTCHours(0, 0, 0, 0); - let todayString = today.toISOString().split('T')[0]; - return t.context.session - .findElement(By.css(`[data-date=${todayString}]`)) - .click(); -}; - const setDateToJanFirst2019 = async function (t) { await t.context.session.findElement(By.css(ex.inputSelector)).click(); return t.context.session.executeScript(function () { diff --git a/test/tests/grid_LayoutGrids.js b/test/tests/grid_LayoutGrids.js index 8358c89a07..7884a8d3ff 100644 --- a/test/tests/grid_LayoutGrids.js +++ b/test/tests/grid_LayoutGrids.js @@ -56,14 +56,6 @@ const focusOnOrInCell = async function (t, cellElement, focusable) { ); }; -const findColIndex = function () { - let el = document.activeElement; - while (!el.hasAttribute('aria-colindex')) { - el = el.parent; - } - return el.attribute('aria-colindex'); -}; - const pageExamples = { ex1: { gridSelector: '#ex1 [role="grid"]', @@ -604,8 +596,6 @@ ariaTest( ]; for (let [exId, selector, focusableElement] of cellSelectors) { - const ex = pageExamples[exId]; - if (exId == 'ex3') { // This test depends on the "page down" button which is not specified by // the widget's description. It does this to avoid relying on behaviors @@ -673,7 +663,6 @@ ariaTest( 'grid/LayoutGrids.html', 'key-page-down', async (t) => { - const ex = pageExamples.ex3; const cellSelectors = [ ['first', '#ex3 [role="row"] [role="gridcell"]:nth-child(1)', 'a'], [ @@ -759,7 +748,6 @@ ariaTest( 'grid/LayoutGrids.html', 'key-page-up', async (t) => { - const ex = pageExamples.ex3; const cellSelectors = [ ['first', '#ex3 [role="row"] [role="gridcell"]:nth-child(1)', 'a'], [ diff --git a/test/tests/grid_dataGrids.js b/test/tests/grid_dataGrids.js index 664b875e05..f63fa5d727 100644 --- a/test/tests/grid_dataGrids.js +++ b/test/tests/grid_dataGrids.js @@ -448,7 +448,6 @@ ariaTest( // Examples 1 and 2 for (let example of [1, 2]) { const gridSelector = ex[example].gridSelector; - const lastColumn = ex[example].lastColumn; const lastRow = ex[example].lastRow; // Index starts at 2 to skip header @@ -489,7 +488,6 @@ ariaTest( 'key-left-arrow', async (t) => { let gridSelector = ex[3].gridSelector; - let lastColumn = ex[3].lastColumn; let lastRow = ex[3].lastRow; let rowSelector = ex[3].rowSelector; @@ -873,7 +871,6 @@ ariaTest( // Examples 1, 2, and 3 for (let example of [1, 2, 3]) { const gridSelector = ex[example].gridSelector; - const rowSelector = ex[example].rowSelector; const lastColumn = ex[example].lastColumn; const lastRow = ex[example].lastRow; const firstInteractiveRow = ex[example].firstInteractiveRow; @@ -930,7 +927,6 @@ ariaTest( // Examples 1, 2, and 3 for (let example of [1, 2, 3]) { const gridSelector = ex[example].gridSelector; - const rowSelector = ex[example].rowSelector; const lastColumn = ex[example].lastColumn; const lastRow = ex[example].lastRow; diff --git a/test/tests/link_link.js b/test/tests/link_link.js index 4cb7e8f343..c178899c03 100644 --- a/test/tests/link_link.js +++ b/test/tests/link_link.js @@ -1,3 +1,5 @@ +/* global goToLink */ + const { ariaTest } = require('..'); const { By, Key } = require('selenium-webdriver'); const assertAriaLabelExists = require('../util/assertAriaLabelExists'); diff --git a/test/tests/menu-button_actions-active-descendant.js b/test/tests/menu-button_actions-active-descendant.js index 3e8678a73d..db4181440a 100644 --- a/test/tests/menu-button_actions-active-descendant.js +++ b/test/tests/menu-button_actions-active-descendant.js @@ -80,7 +80,7 @@ ariaTest( 'button-aria-expanded', async (t) => { const hasAttribute = await t.context.session.executeScript(function () { - selector = arguments[0]; + const selector = arguments[0]; return document.querySelector(selector).hasAttribute('aria-expanded'); }, ex.menubuttonSelector); @@ -368,7 +368,6 @@ ariaTest('"enter" on role="menu"', exampleFile, 'menu-enter', async (t) => { }); ariaTest('"escape" on role="menu"', exampleFile, 'menu-escape', async (t) => { - const menu = await t.context.session.findElement(By.css(ex.menuSelector)); const items = await t.context.queryElements(t, ex.menuitemSelector); for (let item of items) { await scrollToAndOpenMenu(t); @@ -436,7 +435,6 @@ ariaTest('"escape" on role="menu"', exampleFile, 'menu-escape', async (t) => { ariaTest('"home" on role="menu"', exampleFile, 'menu-home', async (t) => { const menu = await t.context.session.findElement(By.css(ex.menuSelector)); - const items = await t.context.queryElements(t, ex.menuitemSelector); await scrollToAndOpenMenu(t); // Send HOME to the menu while aria-activedescendant is the first item @@ -462,7 +460,6 @@ ariaTest('"home" on role="menu"', exampleFile, 'menu-home', async (t) => { ariaTest('"end" on role="menu"', exampleFile, 'menu-end', async (t) => { const menu = await t.context.session.findElement(By.css(ex.menuSelector)); - const items = await t.context.queryElements(t, ex.menuitemSelector); const last = ex.numMenuitems - 1; await scrollToAndOpenMenu(t); diff --git a/test/tests/menu-button_actions.js b/test/tests/menu-button_actions.js index eafbad0732..29ca750272 100644 --- a/test/tests/menu-button_actions.js +++ b/test/tests/menu-button_actions.js @@ -15,12 +15,6 @@ const ex = { lastactionSelector: '#action_output', }; -const getFocusText = function (t) { - return t.context.session.executeScript(function () { - return document.activeElement.textContent.trim(); - }); -}; - const checkFocus = function (t, selector, index) { return t.context.session.executeScript( function () { @@ -70,7 +64,7 @@ ariaTest( 'menu-button-aria-expanded', async (t) => { const hasAttribute = await t.context.session.executeScript(function () { - selector = arguments[0]; + const selector = arguments[0]; return document.querySelector(selector).hasAttribute('aria-expanded'); }, ex.menubuttonSelector); diff --git a/test/tests/menu-button_links.js b/test/tests/menu-button_links.js index d120fe4fc1..317a5908dd 100644 --- a/test/tests/menu-button_links.js +++ b/test/tests/menu-button_links.js @@ -93,7 +93,7 @@ ariaTest( 'button-aria-expanded', async (t) => { const hasAttribute = await t.context.session.executeScript(function () { - selector = arguments[0]; + const selector = arguments[0]; return document.querySelector(selector).hasAttribute('aria-expanded'); }, ex.menubuttonSelector); diff --git a/test/tests/menubar_menubar-editor.js b/test/tests/menubar_menubar-editor.js index 837386973a..a6b684572b 100644 --- a/test/tests/menubar_menubar-editor.js +++ b/test/tests/menubar_menubar-editor.js @@ -1313,8 +1313,6 @@ ariaTest( ) { const item = items[itemIndex]; const itemText = await item.getText(); - // Account for wrapping - const nextItemIndex = itemIndex + 1; // Send UP to the item await item.sendKeys(Key.HOME); @@ -1357,8 +1355,6 @@ ariaTest( ) { const item = items[itemIndex]; const itemText = await item.getText(); - // Account for wrapping - const nextItemIndex = itemIndex + 1; // Send UP to the item await item.sendKeys(Key.END); diff --git a/test/tests/menubar_menubar-navigation.js b/test/tests/menubar_menubar-navigation.js index 1c69a5cd2b..8e6f362f91 100644 --- a/test/tests/menubar_menubar-navigation.js +++ b/test/tests/menubar_menubar-navigation.js @@ -352,11 +352,6 @@ ariaTest( exampleFile, 'sub-menuitem-aria-haspopup', async (t) => { - const menubarMenuitems = await t.context.queryElements( - t, - ex.menubarMenuitemSelector - ); - for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) { const menuItems = await t.context.queryElements( t, @@ -1276,7 +1271,6 @@ ariaTest( t, ex.menubarMenuitemSelector ); - const menus = await t.context.queryElements(t, ex.menuSelector); // Test all the level one menuitems @@ -1363,7 +1357,6 @@ ariaTest( t, ex.menubarMenuitemSelector ); - const menus = await t.context.queryElements(t, ex.menuSelector); // Test all the level one menuitems @@ -1446,7 +1439,6 @@ ariaTest('HOME moves focus in menu', exampleFile, 'submenu-home', async (t) => { t, ex.menubarMenuitemSelector ); - const menus = await t.context.queryElements(t, ex.menuSelector); // Test all the level one menuitems @@ -1512,7 +1504,6 @@ ariaTest('END moves focus in menu', exampleFile, 'submenu-end', async (t) => { t, ex.menubarMenuitemSelector ); - const menus = await t.context.queryElements(t, ex.menuSelector); // Test all the level one menuitems diff --git a/test/tests/slider_slider-2.js b/test/tests/slider_slider-2.js index a3649f9127..498d66e3da 100644 --- a/test/tests/slider_slider-2.js +++ b/test/tests/slider_slider-2.js @@ -513,7 +513,6 @@ ariaTest( await tempSlider.sendKeys(Key.ARROW_LEFT); } - let sliderVal = parseInt(ex.tempDefault) + 1; t.is( await tempSlider.getAttribute('aria-valuenow'), ex.tempMin.toString(), @@ -619,7 +618,6 @@ ariaTest( await tempSlider.sendKeys(Key.ARROW_DOWN); } - let sliderVal = parseInt(ex.tempDefault) + 1; t.is( await tempSlider.getAttribute('aria-valuenow'), ex.tempMin.toString(), diff --git a/test/tests/tabs_tabs-1.js b/test/tests/tabs_tabs-1.js index 2b972b3c51..a016e6aeb5 100644 --- a/test/tests/tabs_tabs-1.js +++ b/test/tests/tabs_tabs-1.js @@ -1,5 +1,5 @@ const { ariaTest } = require('..'); -const { By, Key } = require('selenium-webdriver'); +const { Key } = require('selenium-webdriver'); const assertAttributeValues = require('../util/assertAttributeValues'); const assertAriaControls = require('../util/assertAriaControls'); const assertAriaLabelledby = require('../util/assertAriaLabelledby'); diff --git a/test/tests/tabs_tabs-2.js b/test/tests/tabs_tabs-2.js index b2706b3b78..608e7d803d 100644 --- a/test/tests/tabs_tabs-2.js +++ b/test/tests/tabs_tabs-2.js @@ -365,7 +365,6 @@ ariaTest( ariaTest('HOME key moves focus', exampleFile, 'key-home', async (t) => { const tabs = await t.context.queryElements(t, ex.tabSelector); - const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector); for (let index = 0; index < tabs.length; index++) { // Put focus on the tab await openTabAtIndex(t, index); @@ -383,7 +382,6 @@ ariaTest('HOME key moves focus', exampleFile, 'key-home', async (t) => { ariaTest('END key moves focus', exampleFile, 'key-end', async (t) => { const tabs = await t.context.queryElements(t, ex.tabSelector); - const tabpanels = await t.context.queryElements(t, ex.tabpanelSelector); for (let index = 0; index < tabs.length; index++) { // Put focus on the tab await openTabAtIndex(t, index); diff --git a/test/tests/toolbar_toolbar.js b/test/tests/toolbar_toolbar.js index b69682d5e6..500129a274 100644 --- a/test/tests/toolbar_toolbar.js +++ b/test/tests/toolbar_toolbar.js @@ -41,24 +41,6 @@ const ex = { toolbarSelector: '#ex1 [role="toolbar"]', }; -const clickAndWait = async function (t, selector) { - let element = await t.context.session.findElement(By.css(selector)); - await element.click(); - - return await t.context.session - .wait( - async function () { - let tabindex = await element.getAttribute('tabindex'); - return tabindex === '0'; - }, - t.context.waitTime, - 'Timeout waiting for click to set tabindex="0" on: ' + selector - ) - .catch((err) => { - return err; - }); -}; - const sendKeyAndAssertSelectorIsHidden = async function ( t, key, diff --git a/test/tests/treegrid_treegrid-1.js b/test/tests/treegrid_treegrid-1.js index 4782468420..1c5fc4fdc7 100644 --- a/test/tests/treegrid_treegrid-1.js +++ b/test/tests/treegrid_treegrid-1.js @@ -107,13 +107,6 @@ const checkFocusOnParentEmail = async function (t, emailIndex) { ); }; -const isTopLevelFolder = async function (t, el) { - return t.context.session.executeScript(function () { - const el = arguments[0]; - return el.parentElement.getAttribute('role') === 'tree'; - }, el); -}; - const isOpenedThread = async function (el) { return (await el.getAttribute('aria-expanded')) === 'true'; }; diff --git a/test/tests/treeview_treeview-1a.js b/test/tests/treeview_treeview-1a.js index 5fbdc767a4..321481fe4f 100644 --- a/test/tests/treeview_treeview-1a.js +++ b/test/tests/treeview_treeview-1a.js @@ -149,8 +149,6 @@ ariaTest( for (let folder of folders) { // If the folder is displayed if (await folder.isDisplayed()) { - const folderText = await folder.getText(); - // By default, all folders will be closed t.is(await folder.getAttribute('aria-expanded'), 'false'); t.is( diff --git a/test/tests/treeview_treeview-1b.js b/test/tests/treeview_treeview-1b.js index a35f229291..1058111b10 100644 --- a/test/tests/treeview_treeview-1b.js +++ b/test/tests/treeview_treeview-1b.js @@ -176,7 +176,7 @@ ariaTest( exampleFile, 'treeitem-aria-setsize', async (t) => { - for (const [level, levelSelectors] of Object.entries( + for (const [, levelSelectors] of Object.entries( ex.treeitemGroupSelectors )) { for (const selector of levelSelectors) { @@ -204,7 +204,7 @@ ariaTest( exampleFile, 'treeitem-aria-posinset', async (t) => { - for (const [level, levelSelectors] of Object.entries( + for (const [, levelSelectors] of Object.entries( ex.treeitemGroupSelectors )) { for (const selector of levelSelectors) { @@ -263,8 +263,6 @@ ariaTest( for (let folder of folders) { // If the folder is displayed if (await folder.isDisplayed()) { - const folderText = await folder.getText(); - // By default, all folders will be closed t.is(await folder.getAttribute('aria-expanded'), 'false'); t.is( diff --git a/test/tests/treeview_treeview-2a.js b/test/tests/treeview_treeview-2a.js index addecb38a5..49dba3afe0 100644 --- a/test/tests/treeview_treeview-2a.js +++ b/test/tests/treeview_treeview-2a.js @@ -182,8 +182,6 @@ ariaTest( for (let folder of folders) { // If the folder is displayed if (await folder.isDisplayed()) { - const folderText = await folder.getText(); - // By default, all folders will be closed t.is(await folder.getAttribute('aria-expanded'), 'false'); t.is( diff --git a/test/tests/treeview_treeview-2b.js b/test/tests/treeview_treeview-2b.js index a0668a4c75..1acd66bce0 100644 --- a/test/tests/treeview_treeview-2b.js +++ b/test/tests/treeview_treeview-2b.js @@ -214,8 +214,6 @@ ariaTest( for (let folder of folders) { // If the folder is displayed if (await folder.isDisplayed()) { - const folderText = await folder.getText(); - // By default, all folders will be closed t.is(await folder.getAttribute('aria-expanded'), 'false'); t.is( @@ -270,9 +268,7 @@ ariaTest( exampleFile, 'treeitem-aria-setsize', async (t) => { - for (const [level, levelSelectors] of Object.entries( - ex.groupItemSelectors - )) { + for (const [, levelSelectors] of Object.entries(ex.groupItemSelectors)) { for (const selector of levelSelectors) { const items = await t.context.queryElements(t, selector); const setsize = items.length; @@ -315,9 +311,7 @@ ariaTest( exampleFile, 'treeitem-aria-posinset', async (t) => { - for (const [level, levelSelectors] of Object.entries( - ex.groupItemSelectors - )) { + for (const [, levelSelectors] of Object.entries(ex.groupItemSelectors)) { for (const selector of levelSelectors) { const items = await t.context.queryElements(t, selector); let pos = 0; diff --git a/test/util/assertAriaDescribedby.js b/test/util/assertAriaDescribedby.js index f97b8d87e3..0d730991f4 100644 --- a/test/util/assertAriaDescribedby.js +++ b/test/util/assertAriaDescribedby.js @@ -1,4 +1,3 @@ -const { By } = require('selenium-webdriver'); const assert = require('assert'); /** diff --git a/test/util/assertDotValue.js b/test/util/assertDotValue.js index c76f0f232f..e4dbdba814 100644 --- a/test/util/assertDotValue.js +++ b/test/util/assertDotValue.js @@ -1,4 +1,3 @@ -const { By } = require('selenium-webdriver'); const assert = require('assert'); /** @@ -18,7 +17,7 @@ module.exports = async function assertDotValue( ) { let valueOfAttr = await t.context.session.executeScript( async function () { - const [selector, attr, value] = arguments; + const [selector, attr] = arguments; let el = document.querySelector(selector); return el[attr]; }, diff --git a/test/util/assertHasFocus.js b/test/util/assertHasFocus.js index 7ad48003ec..64f710f020 100644 --- a/test/util/assertHasFocus.js +++ b/test/util/assertHasFocus.js @@ -1,6 +1,3 @@ -const { By, Key } = require('selenium-webdriver'); -const assert = require('assert'); - /** * Confirm the continuous subset of elements are in tab order for a test page * diff --git a/test/util/assertTabOrder.js b/test/util/assertTabOrder.js index 317bdd62dc..b3cbb84fad 100644 --- a/test/util/assertTabOrder.js +++ b/test/util/assertTabOrder.js @@ -19,7 +19,7 @@ const focusMatchesElement = async function (t, selector) { module.exports = async function assertTabOrder(t, tabOrderSelectors) { // Focus on the first element in the list await t.context.session.executeScript(function () { - selector = arguments[0]; + const selector = arguments[0]; document.querySelector(selector).focus(); }, tabOrderSelectors[0]); diff --git a/test/util/force-serial.js b/test/util/force-serial.js index e0b8227751..a242040cc5 100644 --- a/test/util/force-serial.js +++ b/test/util/force-serial.js @@ -8,7 +8,7 @@ function bindPort(port) { }); }; - return new Promise((resolve) => { + return new Promise((resolve, reject) => { server.listen(port, () => resolve(release)); server.on('error', (err) => { if (err.code === 'EADDRINUSE') { diff --git a/test/util/report.js b/test/util/report.js index ce172f8990..eed659add1 100644 --- a/test/util/report.js +++ b/test/util/report.js @@ -195,10 +195,8 @@ const getRegressionTestCoverage = function (exampleCoverage) { let testRegex = /^# (\S+) [>›] (\S+\.html) \[data-test-id="(\S+)"\]/gm; let matchResults; - // eslint-disable-next-line no-cond-assign while ((matchResults = testRegex.exec(avaResults))) { let example = matchResults[2]; - let dataTestId = matchResults[3]; // If the test file has a data-test-id, the data-test-id must exist on // the test page.