Commit 142c88c9 authored by dpapad's avatar dpapad Committed by Commit Bot

Various WebUI tests: Use const instead of let where possible.

CL produced with ESLint --fix and clang-format.

This is in preparation for turning on the 'prefer-const' ESLint rule for that
folder.

Bug: 720034
Change-Id: If8287f806766c6addfe8ca32753f50ba3a5d29fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1884764
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710186}
parent b1574057
......@@ -620,12 +620,12 @@ suite('<bookmarks-item> CommandManager integration', function() {
await test_util.flushTasks();
let dropdown = commandManager.$.dropdown.getIfExists();
let dialog = dropdown.getDialog();
const dropdown = commandManager.$.dropdown.getIfExists();
const dialog = dropdown.getDialog();
assertTrue(dropdown.open);
let x = dialog.offsetLeft + dialog.offsetWidth + 5;
let y = dialog.offsetHeight;
const x = dialog.offsetLeft + dialog.offsetWidth + 5;
const y = dialog.offsetHeight;
// Ensure the dialog is the target even when clicking outside it, and send
// a context menu event which should immediately dismiss the dialog,
......
......@@ -283,7 +283,7 @@ suite('drag and drop', function() {
test('drag multiple list items preserve displaying order', function() {
// Dragging multiple items with different selection order.
store.data.selection.items = new Set(['15', '13']);
let dragElement = getListItem('13');
const dragElement = getListItem('13');
simulateDragStart(dragElement);
assertDeepEquals(['13', '15'], getDragIds());
});
......
......@@ -84,7 +84,7 @@ test('bookmarkManagerPrivate', async () => {
function getSubtree() {
bookmarkManager.getSubtree(childFolder.id, false, pass(function(result) {
let children = result[0].children;
const children = result[0].children;
assertEquals(3, children.length);
assertEquals(childNodeA.id, children[0].id);
assertEquals(childNodeB.id, children[1].id);
......@@ -95,7 +95,7 @@ test('bookmarkManagerPrivate', async () => {
function getSubtreeFoldersOnly() {
bookmarkManager.getSubtree(childFolder.id, true, pass(function(result) {
let children = result[0].children;
const children = result[0].children;
assertEquals(1, children.length);
assertEquals(
grandChildFolder.id, children[0].id);
......@@ -215,8 +215,8 @@ test('bookmarkManagerPrivate', async () => {
}
assertTrue(barIndex + 2 < result.length);
let last = result[barIndex + 1];
let last2 = result[barIndex + 2];
const last = result[barIndex + 1];
const last2 = result[barIndex + 2];
assertEquals(fooNode.title, last.title);
assertEquals(fooNode.url, last.url);
assertEquals(fooNode.parentId, last.parentId);
......
......@@ -43,7 +43,7 @@ suite('Bookmarks policies', function() {
test('canEdit updates when changed', async function() {
const commandManager = bookmarks.CommandManager.getInstance();
let action = await store.waitForAction('set-can-edit');
const action = await store.waitForAction('set-can-edit');
assertFalse(store.data.prefs.canEdit);
assertFalse(commandManager.canExecute(Command.DELETE, new Set(['11'])));
......
......@@ -170,7 +170,7 @@ function findFolderNode(rootNode, id) {
* @return {Object}
*/
function simulateChromeExtensionAPITest() {
let promises = [];
const promises = [];
function pass(callback) {
let resolve;
assertEquals(undefined, chrome.runtime.lastError);
......
......@@ -408,7 +408,7 @@ suite('CrActionMenu', function() {
dots.style.marginLeft = '800px';
let dotsRect = dots.getBoundingClientRect();
const dotsRect = dots.getBoundingClientRect();
// Anchored at right-top by default.
menu.showAt(dots);
......
......@@ -89,7 +89,7 @@ cr.define('cr_fingerprint_progress_arc_test', function() {
* @param {!Array<Point>} listOfPoints
*/
function assertListOfColorsEqual(expectedColor, listOfPoints) {
for (let point of listOfPoints) {
for (const point of listOfPoints) {
assertColorEquals(expectedColor, getRGBData(point));
}
}
......
......@@ -227,7 +227,7 @@ suite('cr-input', function() {
assertEquals(0, underline.offsetWidth);
assertEquals('hidden', getComputedStyle(errorLabel).visibility);
let whenTransitionEnd =
const whenTransitionEnd =
test_util.eventToPromise('transitionend', underline);
crInput.invalid = true;
......
......@@ -23,7 +23,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
});
test('active', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kNone,
};
......@@ -37,7 +37,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
test('user_recommended', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kUserPolicyRecommended,
policyValue: 'bar',
......@@ -54,7 +54,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
});
test('device_recommended', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kDevicePolicyRecommended,
policyValue: 'bar',
......@@ -71,7 +71,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
});
test('user_enforced', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kUserPolicyEnforced,
policyValue: 'foo',
......@@ -88,7 +88,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
});
test('device_enforced', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kDevicePolicyEnforced,
policyValue: 'foo',
......@@ -105,7 +105,7 @@ suite('CrPolicyNetworkBehaviorMojo', function() {
});
test('extension_controlled', function() {
let property = {
const property = {
activeValue: 'foo',
policySource: mojom.PolicySource.kActiveExtension,
};
......
......@@ -24,14 +24,14 @@ suite('cr-searchable-drop-down', function() {
* the drop down.
*/
function search(searchTerm) {
let input = dropDown.shadowRoot.querySelector('cr-input');
const input = dropDown.shadowRoot.querySelector('cr-input');
input.value = searchTerm;
input.fire('input');
Polymer.dom.flush();
}
function blur() {
let input = dropDown.shadowRoot.querySelector('cr-input');
const input = dropDown.shadowRoot.querySelector('cr-input');
input.fire('blur');
Polymer.dom.flush();
}
......@@ -81,7 +81,7 @@ suite('cr-searchable-drop-down', function() {
test('correct list items', function() {
setItems(['one', 'two', 'three']);
let itemList = getList();
const itemList = getList();
assertEquals(3, itemList.length);
assertEquals('one', itemList[0].textContent.trim());
......
......@@ -113,10 +113,9 @@ TEST_F('HistoryFocusTest', 'All', function() {
test('list focus and keyboard nav', async () => {
app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS);
let focused;
let items;
await test_util.flushTasks();
Polymer.dom.flush();
items = polymerSelectAll(element, 'history-item');
const items = polymerSelectAll(element, 'history-item');
items[2].$.checkbox.focus();
focused = items[2].$.checkbox.getFocusableElement();
......
......@@ -12,7 +12,7 @@ import {TestNtpBackgroundProxy} from './test_ntp_background_proxy.js';
suite('NuxNtpBackgroundTest', function() {
/** @type {!Array<!NtpBackgroundData} */
let backgrounds = [
const backgrounds = [
{
id: 0,
title: 'Art',
......
......@@ -5,6 +5,7 @@
// Note: The API should stay in sync with the IDL definitions in
// third_party/WebKit/Source/core/mojo
// eslint-disable-next-line no-var
var Mojo = Mojo || {};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment