Commit 2a33506c authored by Jesse Schettler's avatar Jesse Schettler Committed by Chromium LUCI CQ

scanning: Fix color mode comment and variable name

Bug: 1059779
Change-Id: I71852964a000718a4d2db8ee3bd2c988ab0356ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628030
Commit-Queue: Jesse Schettler <jschettler@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843218}
parent 4c023c87
...@@ -6,6 +6,7 @@ import './scanning.mojom-lite.js'; ...@@ -6,6 +6,7 @@ import './scanning.mojom-lite.js';
import './scan_settings_section.js'; import './scan_settings_section.js';
import './strings.m.js'; import './strings.m.js';
import {assert} from 'chrome://resources/js/assert.m.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
...@@ -52,19 +53,21 @@ Polymer({ ...@@ -52,19 +53,21 @@ Polymer({
}, },
/** /**
* Black and white should be the default option if it exists. If not, use * Use the default option if it exists. If not, use the first color mode in
* the first color mode in the color modes array. * the color modes array.
* @return {string} * @return {string}
* @private * @private
*/ */
getDefaultSelectedColorMode_() { getDefaultSelectedColorMode_() {
const blackAndWhiteIndex = this.colorModes.findIndex((colorMode) => { assert(this.colorModes.length > 0);
const defaultColorModeIndex = this.colorModes.findIndex((colorMode) => {
return this.isDefaultColorMode_(colorMode); return this.isDefaultColorMode_(colorMode);
}); });
return blackAndWhiteIndex === -1 ? return defaultColorModeIndex === -1 ?
this.colorModes[0].toString() : this.colorModes[0].toString() :
this.colorModes[blackAndWhiteIndex].toString(); this.colorModes[defaultColorModeIndex].toString();
}, },
/** /**
......
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