Bug 1656294 - Enable all ESLint rules on accessible/tests/mochitest/*.xhtml files. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D85459
This commit is contained in:
Sonia Singla 2020-08-27 09:36:18 +00:00
parent 3d54695b31
commit 3c29de9496
14 changed files with 33 additions and 62 deletions

View File

@ -332,35 +332,6 @@ module.exports = {
"no-async-promise-executor": "off",
},
},
{
files: [
"accessible/tests/mochitest/actions/test_keys_menu.xhtml",
"accessible/tests/mochitest/elm/test_listbox.xhtml",
"accessible/tests/mochitest/events/test_focus_autocomplete.xhtml",
"accessible/tests/mochitest/events/test_focus_contextmenu.xhtml",
"accessible/tests/mochitest/events/test_tree.xhtml",
"accessible/tests/mochitest/hittest/test_zoom_tree.xhtml",
"accessible/tests/mochitest/name/test_general.xhtml",
"accessible/tests/mochitest/name/test_tree.xhtml",
"accessible/tests/mochitest/selectable/test_listbox.xhtml",
"accessible/tests/mochitest/states/test_expandable.xhtml",
"accessible/tests/mochitest/tree/test_button.xhtml",
"accessible/tests/mochitest/tree/test_tree.xhtml",
"accessible/tests/mochitest/treeupdate/test_contextmenu.xhtml",
"accessible/tests/mochitest/treeupdate/test_menu.xhtml",
],
rules: {
"object-shorthand": "off",
"mozilla/no-compare-against-boolean-literals": "off",
"mozilla/use-cc-etc": "off",
"consistent-return": "off",
"no-redeclare": "off",
"no-sequences": "off",
"no-shadow": "off",
"no-unused-vars": "off",
"no-useless-call": "off",
},
},
{
files: [
"testing/mochitest/browser-harness.xhtml",

View File

@ -18,7 +18,7 @@
function doTest()
{
var id = "";
var listbox = null, acc = null;
var acc = null;
//////////////////////////////////////////////////////////////////////////
// Simple listbox. There is no nsIAccessibleTable interface.

View File

@ -36,7 +36,7 @@
// This is the hacks needed to use a searchbar without browser.js.
var BrowserSearch = {
updateOpenSearchBadge: function() {}
updateOpenSearchBadge() {}
};
////////////////////////////////////////////////////////////////////////////
@ -151,7 +151,7 @@
this.invoke = function focusOnMouseOver_invoke()
{
this.id = aIDFunc.call(null, aIDFuncArg);
this.id = aIDFunc(aIDFuncArg);
this.node = getNode(this.id);
this.window = this.node.ownerGlobal;
@ -181,7 +181,7 @@
this.getID = function focusOnMouseOver_getID()
{
return "mouse over on " + prettyName(aIDFunc.call(null, aIDFuncArg));
return "mouse over on " + prettyName(aIDFunc(aIDFuncArg));
}
this.doMouseMoveFlood = function focusOnMouseOver_doMouseMoveFlood(aThis)
@ -209,11 +209,10 @@
this.invoke = function selectByClick_invoke()
{
var id = aIDFunc.call(null, aIDFuncArg);
var id = aIDFunc(aIDFuncArg);
var node = getNode(id);
var targetWindow = node.ownerGlobal;
var x = 0, y = 0;
if (node.localName == "tree") {
var tree = getAccessible(node);
var accessible = getAccessible(id);
@ -221,8 +220,8 @@
var itemX = {}, itemY = {}, treeX = {}, treeY = {};
accessible.getBounds(itemX, itemY, {}, {});
tree.getBounds(treeX, treeY, {}, {});
x = itemX.value - treeX.value;
y = itemY.value - treeY.value;
this.x = itemX.value - treeX.value;
this.y = itemY.value - treeY.value;
}
}
@ -231,7 +230,7 @@
this.getID = function selectByClick_getID()
{
return "select by click " + prettyName(aIDFunc.call(null, aIDFuncArg));
return "select by click " + prettyName(aIDFunc(aIDFuncArg));
}
}
@ -240,20 +239,19 @@
function getItem(aItemObj)
{
var autocomplete = aItemObj.autocomplete;
var autocompleteNode = aItemObj.autocompleteNode;
// XUL searchbar
if (autocompleteNode.localName == "searchbar") {
var popupNode = autocompleteNode._popup;
let popupNode = autocompleteNode._popup;
if (popupNode) {
var list = getAccessible(popupNode);
let list = getAccessible(popupNode);
return list.getChildAt(aItemObj.index);
}
}
// XUL autocomplete
var popupNode = autocompleteNode.popup;
let popupNode = autocompleteNode.popup;
if (!popupNode) {
// HTML form autocomplete
var controller = Cc["@mozilla.org/autocomplete/controller;1"].
@ -263,13 +261,14 @@
if (popupNode) {
if ("richlistbox" in popupNode) {
var list = getAccessible(popupNode.richlistbox);
let list = getAccessible(popupNode.richlistbox);
return list.getChildAt(aItemObj.index);
}
var list = getAccessible(popupNode.tree);
let list = getAccessible(popupNode.tree);
return list.getChildAt(aItemObj.index + 1);
}
return null;
}
function getTextEntry(aID)

View File

@ -24,8 +24,8 @@
var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
if (winLowerThanVista) {
var version = Components.classes["@mozilla.org/system-info;1"]
.getService(Components.interfaces.nsIPropertyBag2)
var version = Cc["@mozilla.org/system-info;1"]
.getService(Ci.nsIPropertyBag2)
.getProperty("version");
version = parseFloat(version);
winLowerThanVista = !(version >= 6.0);

View File

@ -259,6 +259,7 @@
this.invoke = function invalidateRow_invoke()
{
// Fire 'TreeInvalidated' event by InvalidateRow()
// eslint-disable-next-line no-unused-vars
var colCount = gTree.columns.count;
var column = gTree.columns.getFirstColumn();
while (column) {

View File

@ -57,7 +57,7 @@
hitTest(tree, treecols, treecol1);
// tree rows and cells
var [x, y] = CSSToDevicePixels(tabWindow, cssX, cssY);
[x, y] = CSSToDevicePixels(tabWindow, cssX, cssY);
testChildAtPoint(treeAcc, x, y, rowAcc, cellAcc);
testChildAtPoint(rowAcc, x, y, cellAcc, cellAcc);

View File

@ -113,7 +113,7 @@
// Name from the @title attribute of <toolbaritem/> (original bug 237249).
// Direct child of toolbaritem.
var toolbarItemChildAcc = testName("toolbaritem_child", null);
testName("toolbaritem_child", null);
// Child from subtree of toolbaritem.
testName("toolbaritem_hboxbutton", "button");

View File

@ -143,7 +143,7 @@
var gQueue = null;
function doTest()
{
var gQueue = new eventQueue(EVENT_REORDER);
gQueue = new eventQueue(EVENT_REORDER);
gQueue.push(new treeTester("tree"));
gQueue.push(new tableTester("table", true, "t_col1", "t_col2"));

View File

@ -48,7 +48,7 @@
testSelectableSelection(select, [ ],
"removeItemFromSelection(1): ");
todo(select.selectAll() == false,
todo(!select.selectAll(),
"No way to select all items in listbox '" + id + "'");
testSelectableSelection(select, [ "lb1_item1" ], "selectAll: ");
@ -59,11 +59,11 @@
//////////////////////////////////////////////////////////////////////////
// multiple selectable listbox
var id = "listbox2";
id = "listbox2";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for list of " + id);
var select = getAccessible(id, [nsIAccessibleSelectable]);
select = getAccessible(id, [nsIAccessibleSelectable]);
testSelectableSelection(select, [ ]);
select.addItemToSelection(1);

View File

@ -63,7 +63,7 @@
// This is the hacks needed to use a searchbar without browser.js.
var BrowserSearch = {
updateOpenSearchBadge: function() {}
updateOpenSearchBadge() {}
};
SimpleTest.waitForExplicitFinish();

View File

@ -33,7 +33,7 @@
//////////////////////////////////////////////////////////////////////////
// toolbarbutton
var accTree = {
accTree = {
role: ROLE_PUSHBUTTON,
name: "hello",
children: [ ]

View File

@ -73,12 +73,12 @@
var view = aTree.view;
var columnCount = aTree.columns.count;
for (var idx = 0; idx < columnCount; idx++)
for (let idx = 0; idx < columnCount; idx++)
accTreeForColumns.children.push({ COLUMNHEADER: [ ] });
if (!aTree.hasAttribute("hidecolumnpicker"))
accTreeForColumns.children.push({ PUSHBUTTON: [ { MENUPOPUP: [] } ] });
for (var idx = 0; idx < view.rowCount; idx++)
for (let idx = 0; idx < view.rowCount; idx++)
accTreeForTree.children.push(getTreeItemAccTree(aRole, columnCount));
testAccessibleTree(aTree, accTreeForTree);
@ -113,7 +113,7 @@
function doTest()
{
var gQueue = new eventQueue(EVENT_REORDER);
gQueue = new eventQueue(EVENT_REORDER);
gQueue.push(new treeChecker("list", new nsTableTreeView(3), ROLE_LIST));
gQueue.push(new treeChecker("tree", new nsTreeTreeView(), ROLE_OUTLINE));

View File

@ -129,7 +129,7 @@
function getMenuTree1()
{
if (LINUX || SOLARIS) {
var tree = {
let tree = {
role: ROLE_MENUPOPUP,
children: [
{
@ -153,7 +153,7 @@
}
// Windows
var tree = {
let tree = {
role: ROLE_MENUPOPUP,
children: [
{
@ -189,7 +189,7 @@
{
var tree = getMenuTree1();
if (LINUX || SOLARIS) {
var submenuTree =
let submenuTree =
{
name: "item2.0",
role: ROLE_PARENT_MENUITEM,
@ -200,7 +200,7 @@
}
// Windows
var submenuTree =
let submenuTree =
{
name: "item2.0",
role: ROLE_PARENT_MENUITEM,

View File

@ -22,7 +22,7 @@
function openMenu(aID)
{
this.menuNode = getNode(aID),
this.menuNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_FOCUS, this.menuNode)