Bug 1497514 - Initialize BasicCardPage selectedStateKey to 'selectPaymentCard'. r=MattN
☠☠ backed out by 5f7e9756a2ef ☠ ☠
authorDiego Pino Garcia <dpino@igalia.com>
Thu, 18 Oct 2018 15:25:49 -0700
changeset 490341 8b3b53341da242116ef6cba6a4d8439bad5b0fb2
parent 490340 0b54085a89d475b6ea1c7ded43a69451c0c400a3
child 490342 9c7087c217509cc8ad7186295e12410264f3b40a
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersMattN
bugs1497514
milestone64.0a1
Bug 1497514 - Initialize BasicCardPage selectedStateKey to 'selectPaymentCard'. r=MattN Also require basicCardPage has a selectedStateKey
browser/components/payments/res/containers/basic-card-form.js
browser/components/payments/res/mixins/PaymentStateSubscriberMixin.js
browser/components/payments/res/paymentRequest.js
browser/components/payments/test/browser/browser.ini
browser/components/payments/test/browser/browser_onboarding_wizard.js
browser/components/payments/test/browser/browser_payments_onboarding_wizard.js
--- a/browser/components/payments/res/containers/basic-card-form.js
+++ b/browser/components/payments/res/containers/basic-card-form.js
@@ -146,16 +146,20 @@ export default class BasicCardForm exten
       "basic-card-page": basicCardPage,
     } = state;
 
     if (this.id && page && page.id !== this.id) {
       log.debug(`BasicCardForm: no need to further render inactive page: ${page.id}`);
       return;
     }
 
+    if (!basicCardPage.selectedStateKey) {
+      throw new Error("A `selectedStateKey` is required");
+    }
+
     let editing = !!basicCardPage.guid;
     this.cancelButton.textContent = this.dataset.cancelButtonLabel;
     this.backButton.textContent = this.dataset.backButtonLabel;
     if (editing) {
       this.saveButton.textContent = this.dataset.updateButtonLabel;
     } else {
       this.saveButton.textContent = this.dataset.nextButtonLabel;
     }
--- a/browser/components/payments/res/mixins/PaymentStateSubscriberMixin.js
+++ b/browser/components/payments/res/mixins/PaymentStateSubscriberMixin.js
@@ -12,17 +12,17 @@ import PaymentsStore from "../PaymentsSt
  * State of the payment request dialog.
  */
 export let requestStore = new PaymentsStore({
   changesPrevented: false,
   orderDetailsShowing: false,
   "basic-card-page": {
     guid: null,
     // preserveFieldValues: true,
-    selectedStateKey: null,
+    selectedStateKey: "selectedPaymentCard",
   },
   "address-page": {
     guid: null,
     selectedStateKey: null,
     title: "",
   },
   "payment-summary": {
   },
--- a/browser/components/payments/res/paymentRequest.js
+++ b/browser/components/payments/res/paymentRequest.js
@@ -162,16 +162,19 @@ var paymentRequest = {
           title: paymentDialog.dataset.billingAddressTitleAdd,
         });
       }
     } else if (!hasSavedCards) {
       state.page = {
         id: "basic-card-page",
         onboardingWizard: true,
       };
+      state["basic-card-page"] = {
+        selectedStateKey: "selectedPaymentCard",
+      };
     }
 
     paymentDialog.setStateFromParent(state);
   },
 
   openPreferences() {
     this.sendMessageToChrome("openPreferences");
   },
--- a/browser/components/payments/test/browser/browser.ini
+++ b/browser/components/payments/test/browser/browser.ini
@@ -9,19 +9,19 @@ support-files =
 
 [browser_address_edit.js]
 skip-if = verify && debug && os == 'mac'
 [browser_card_edit.js]
 skip-if = os == 'linux' && debug # bug 1465673
 [browser_change_shipping.js]
 [browser_dropdowns.js]
 [browser_host_name.js]
+[browser_onboarding_wizard.js]
 [browser_openPreferences.js]
 [browser_payment_completion.js]
-[browser_payments_onboarding_wizard.js]
 [browser_profile_storage.js]
 [browser_request_serialization.js]
 [browser_request_shipping.js]
 [browser_retry.js]
 [browser_shippingaddresschange_error.js]
 [browser_show_dialog.js]
 skip-if = os == 'win' && debug # bug 1418385
 [browser_total.js]
rename from browser/components/payments/test/browser/browser_payments_onboarding_wizard.js
rename to browser/components/payments/test/browser/browser_onboarding_wizard.js