From 71d6c6dab2f1bbd5cf7daf04eedd7773a4397d87 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Mon, 9 Dec 2019 10:30:34 +1100 Subject: [PATCH] display the plan in the plan buttons --- .../templates/components/payment-options.hbs | 8 ++++++-- .../components/payment-options-test.js.es6 | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/templates/components/payment-options.hbs b/assets/javascripts/discourse/templates/components/payment-options.hbs index 46ff10b..06a1388 100644 --- a/assets/javascripts/discourse/templates/components/payment-options.hbs +++ b/assets/javascripts/discourse/templates/components/payment-options.hbs @@ -17,8 +17,12 @@ actionParam=plan class="btn btn-discourse-subscriptions-subscribe" }} -
Monthly
- AUD $5.00 +
+ {{plan.interval}} +
+ + {{format-currency plan.currency plan.amountDollars}} + {{/d-button}} {{/each}} diff --git a/test/javascripts/components/payment-options-test.js.es6 b/test/javascripts/components/payment-options-test.js.es6 index b8c79f8..88b9c0b 100644 --- a/test/javascripts/components/payment-options-test.js.es6 +++ b/test/javascripts/components/payment-options-test.js.es6 @@ -20,7 +20,10 @@ componentTest("Discourse Subscriptions payment options has content", { template: `{{payment-options plans=plans}}`, async test(assert) { - this.set("plans", [1, 2]); + this.set("plans", [ + { currency: 'AUD', interval: 'year', amountDollars: "44.99" }, + { currency: 'GDP', interval: 'month', amountDollars: "9.99" }, + ]); assert.equal( find(".btn-discourse-subscriptions-subscribe").length, @@ -32,6 +35,16 @@ componentTest("Discourse Subscriptions payment options has content", { 0, "The none are selected" ); + assert.equal( + find(".btn-discourse-subscriptions-subscribe:first-child .interval").text().trim(), + "year", + "The plan interval is shown" + ); + assert.equal( + find(".btn-discourse-subscriptions-subscribe:first-child .amount").text().trim(), + "$AUD 44.99", + "The plan amount and currency is shown" + ); } });