From a9434f5723a99f2963b396755c5c6e46eaa0978f Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 11 Sep 2019 20:37:23 +1000 Subject: [PATCH] load in components --- assets/javascripts/discourse/components/stripe-card.js.es6 | 1 + .../discourse/templates/components/donation-form.hbs | 2 +- test/javascripts/components/donation-form-test.es6 | 2 +- test/javascripts/components/stripe-card-test.js.es6 | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index 1eab3f1..2dc388a 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -45,6 +45,7 @@ export default Ember.Component.extend({ actions: { submitStripeCard() { this.stripe.createPaymentMethod('card', this.card).then((result) => { + if (result.error) { this.set('cardError', result.error.message); } diff --git a/assets/javascripts/discourse/templates/components/donation-form.hbs b/assets/javascripts/discourse/templates/components/donation-form.hbs index 641cfb1..6b9f3f5 100644 --- a/assets/javascripts/discourse/templates/components/donation-form.hbs +++ b/assets/javascripts/discourse/templates/components/donation-form.hbs @@ -30,7 +30,7 @@ {{/if}} {{else}} -
+

Your information

diff --git a/test/javascripts/components/donation-form-test.es6 b/test/javascripts/components/donation-form-test.es6 index 1bd5933..b6ce63f 100644 --- a/test/javascripts/components/donation-form-test.es6 +++ b/test/javascripts/components/donation-form-test.es6 @@ -13,7 +13,7 @@ componentTest("Discourse Patrons donation form has content", { }, async test(assert) { - assert.ok(find("#payment-form").length, "The form renders"); + assert.ok(find(".discourse-patrons-section-columns").length, "The card section renders"); assert.ok( find("dummy-component-tag").length, "The stripe component renders" diff --git a/test/javascripts/components/stripe-card-test.js.es6 b/test/javascripts/components/stripe-card-test.js.es6 index 5bfee5b..c36a45b 100644 --- a/test/javascripts/components/stripe-card-test.js.es6 +++ b/test/javascripts/components/stripe-card-test.js.es6 @@ -10,7 +10,7 @@ componentTest("Discourse Patrons stripe card success", { return { createPaymentMethod() { return new Ember.RSVP.Promise((resolve) => { - resolve('payment-method-response'); + resolve({}); }); }, elements() { @@ -32,7 +32,7 @@ componentTest("Discourse Patrons stripe card success", { assert.expect(1); this.set("onSubmit", (arg) => { - assert.equal(arg, "payment-method-response", "payment method created"); + assert.ok(true, "payment method created"); }); await click(".btn-payment");