Commit 558a28dc authored by Nnamdi Theodore Johnson-Kanu's avatar Nnamdi Theodore Johnson-Kanu Committed by Commit Bot

[CrOS cellular] Fix cellular setup currentPage_ error

- Before this CL a console error was thrown in cellular_setup.js in
  onPageChange_() because this.currentPage_ value is undefined before
  cellular_setup ui is attached.


Bug: 1093185
Change-Id: I754fc9d8c0d751a3232032f2e266aa686eeb6225
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414989
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808462}
parent 701ce8dd
...@@ -5,21 +5,41 @@ ...@@ -5,21 +5,41 @@
// clang-format off // clang-format off
// #import 'chrome://os-settings/strings.m.js'; // #import 'chrome://os-settings/strings.m.js';
// #import 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_setup.m.js'; // #import 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_setup.m.js';
// #import 'chrome://resources/cr_components/chromeos/cellular_setup/setup_selection_flow.m.js';
// #import 'chrome://resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js';
// #import {CellularSetupPageName} from 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_types.m.js';
// #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; // #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {assertTrue} from '../../../chai_assert.js'; // #import {assertTrue} from '../../../chai_assert.js';
// clang-format on // clang-format on
suite('CrComponentsCellularSetupTest', function() { suite('CrComponentsCellularSetupTest', function() {
let cellularSetup; let cellularSetupPage;
setup(function() { setup(function() {
cellularSetup = document.createElement('cellular-setup'); cellularSetupPage = document.createElement('cellular-setup');
document.body.appendChild(cellularSetup); document.body.appendChild(cellularSetupPage);
Polymer.dom.flush(); Polymer.dom.flush();
}); });
test('Base test', function() { test('Base test', function() {
const ironPage = cellularSetup.$$('iron-pages'); const ironPage = cellularSetupPage.$$('iron-pages');
assertTrue(!!ironPage); assertTrue(!!ironPage);
}); });
test('Page selection change', function() {
assertTrue(
cellularSetupPage.currentPageName_ ===
cellularSetup.CellularSetupPageName.SETUP_FLOW_SELECTION);
const selectionFlow = cellularSetupPage.$$('setup-selection-flow');
assertTrue(!!selectionFlow);
const psimBtn = selectionFlow.$$('#psim-flow-ui-btn');
assertTrue(!!psimBtn);
psimBtn.click();
assertTrue(
cellularSetupPage.selectedFlow_ ===
cellularSetup.CellularSetupPageName.PSIM_FLOW_UI);
});
}); });
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
test_namespace_rewrites = [ test_namespace_rewrites = [
"cellularSetup.PSimUIState|PSimUIState", "cellularSetup.PSimUIState|PSimUIState",
"cellularSetup.CellularSetupPageName|CellularSetupPageName",
"global.traceAssertionsForTesting|window.traceAssertionsForTesting", "global.traceAssertionsForTesting|window.traceAssertionsForTesting",
"MockInteractions.blur|blur", "MockInteractions.blur|blur",
"MockInteractions.downAndUp|downAndUp", "MockInteractions.downAndUp|downAndUp",
......
...@@ -60,7 +60,9 @@ Polymer({ ...@@ -60,7 +60,9 @@ Polymer({
/** @private */ /** @private */
onPageChange_() { onPageChange_() {
this.currentPage_.initSubflow(); if (this.currentPage_) {
this.currentPage_.initSubflow();
}
}, },
/** @private */ /** @private */
......
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