Commit 729822c0 authored by dpapad's avatar dpapad Committed by Commit Bot

Print Preview 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: 72003
Change-Id: I94a6f0ae63da907e552c659325de600b6b3733c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885553
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710372}
parent 6d673ee9
......@@ -22,10 +22,10 @@ cr.define('advanced_dialog_test', function() {
let destination = null;
/** @type {string} */
let printerId = 'FooDevice';
const printerId = 'FooDevice';
/** @type {string} */
let printerName = 'FooName';
const printerName = 'FooName';
/** @override */
setup(function() {
......
......@@ -89,7 +89,7 @@ cr.define('custom_margins_test', function() {
// Wait for the control elements to be created before updating the state.
container.measurementSystem = measurementSystem;
document.body.appendChild(container);
let controlsAdded = test_util.eventToPromise('dom-change', container);
const controlsAdded = test_util.eventToPromise('dom-change', container);
return controlsAdded.then(() => {
// 8.5 x 11, in pixels
const controls = getControls();
......@@ -275,7 +275,7 @@ cr.define('custom_margins_test', function() {
assertEquals('0', window.getComputedStyle(control).opacity);
});
let onTransitionEnd = getAllTransitions(controls);
const onTransitionEnd = getAllTransitions(controls);
// Controls become visible when margin type CUSTOM is selected.
model.set(
'settings.margins.value', print_preview.MarginsType.CUSTOM);
......@@ -309,7 +309,7 @@ cr.define('custom_margins_test', function() {
assertEquals(defaultMarginPts, control.getPositionInPts());
});
let onTransitionEnd = getAllTransitions(controls);
const onTransitionEnd = getAllTransitions(controls);
// Disappears when preview is loading or an error message is shown.
// Check that all the controls also disappear.
......
......@@ -28,7 +28,7 @@ cr.define('destination_dialog_test', function() {
let destinations = [];
/** @type {!Array<!print_preview.LocalDestinationInfo>} */
let localDestinations = [];
const localDestinations = [];
/** @type {!Array<!print_preview.RecentDestination>} */
let recentDestinations = [];
......
......@@ -53,7 +53,7 @@ cr.define('destination_item_test', function() {
// the destination is stale.
test(assert(TestNames.Offline), function() {
const now = new Date();
let twoMonthsAgo = new Date(now.getTime());
const twoMonthsAgo = new Date(now.getTime());
let month = twoMonthsAgo.getMonth() - 2;
if (month < 0) {
month = month + 12;
......
......@@ -54,7 +54,7 @@ cr.define('destination_settings_test', function() {
// Stub out native layer and cloud print interface.
nativeLayer = new print_preview.NativeLayerStub();
print_preview.NativeLayer.setInstance(nativeLayer);
let localDestinations = [];
const localDestinations = [];
destinations = print_preview_test_utils.getDestinations(
nativeLayer, localDestinations);
nativeLayer.setLocalDestinations(localDestinations);
......@@ -197,7 +197,7 @@ cr.define('destination_settings_test', function() {
* destinations in the dropdown.
*/
function assertDropdownItems(expectedDestinations) {
let options =
const options =
destinationSettings.$.destinationSelect.shadowRoot.querySelectorAll(
'option:not([hidden])');
assertEquals(expectedDestinations.length + 1, options.length);
......
......@@ -245,7 +245,7 @@ cr.define('model_settings_availability_test', function() {
assertTrue(model.settings.mediaSize.available);
// Remove capability.
let capabilities =
const capabilities =
print_preview_test_utils.getCddTemplate(model.destination.id)
.capabilities;
delete capabilities.printer.media_size;
......
......@@ -90,7 +90,8 @@ cr.define('model_test', function() {
* reset to its default value.
*/
const testStickySetting = function(setting, field) {
let promise = test_util.eventToPromise('sticky-setting-changed', model);
const promise =
test_util.eventToPromise('sticky-setting-changed', model);
model.setSetting(setting, stickySettingsChange[field]);
settingsSet.push(field);
return promise.then(
......@@ -99,18 +100,19 @@ cr.define('model_test', function() {
* @return {!Promise} Promise that resolves when setting is reset.
*/
function(e) {
let settings = JSON.parse(e.detail);
const settings = JSON.parse(e.detail);
Object.keys(stickySettingsDefault).forEach(settingName => {
let set = settingsSet.includes(settingName);
const set = settingsSet.includes(settingName);
assertEquals(set, settings[settingName] !== undefined);
if (set) {
let toCompare = settingName == field ? stickySettingsChange :
const toCompare = settingName == field ?
stickySettingsChange :
stickySettingsDefault;
assertDeepEquals(
toCompare[settingName], settings[settingName]);
}
});
let restorePromise =
const restorePromise =
test_util.eventToPromise('sticky-setting-changed', model);
model.setSetting(setting, stickySettingsDefault[field]);
return restorePromise;
......
......@@ -33,7 +33,7 @@ cr.define('print_button_test', function() {
print_preview.NativeLayer.setInstance(nativeLayer);
PolymerTest.clearBody();
nativeLayer.setInitialSettings(initialSettings);
let localDestinationInfos = [
const localDestinationInfos = [
{printerName: 'FooName', deviceName: 'FooDevice'},
];
nativeLayer.setLocalDestinations(localDestinationInfos);
......
......@@ -257,7 +257,7 @@ cr.define('print_preview_test_utils', function() {
* @return {!Array<!print_preview.Destination>}
*/
function getDestinations(nativeLayer, localDestinations) {
let destinations = [];
const destinations = [];
const origin = cr.isChromeOS ? print_preview.DestinationOrigin.CROS :
print_preview.DestinationOrigin.LOCAL;
// Five destinations. FooDevice is the system default.
......
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