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