display the plan in the plan buttons

This commit is contained in:
Rimian Perkins 2019-12-09 10:30:34 +11:00
parent d3eed3546d
commit 71d6c6dab2
2 changed files with 20 additions and 3 deletions

View File

@ -17,8 +17,12 @@
actionParam=plan actionParam=plan
class="btn btn-discourse-subscriptions-subscribe" class="btn btn-discourse-subscriptions-subscribe"
}} }}
<div>Monthly</div> <div class="interval">
AUD $5.00 {{plan.interval}}
</div>
<span class="amount">
{{format-currency plan.currency plan.amountDollars}}
</span>
{{/d-button}} {{/d-button}}
{{/each}} {{/each}}
</div> </div>

View File

@ -20,7 +20,10 @@ componentTest("Discourse Subscriptions payment options has content", {
template: `{{payment-options plans=plans}}`, template: `{{payment-options plans=plans}}`,
async test(assert) { 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( assert.equal(
find(".btn-discourse-subscriptions-subscribe").length, find(".btn-discourse-subscriptions-subscribe").length,
@ -32,6 +35,16 @@ componentTest("Discourse Subscriptions payment options has content", {
0, 0,
"The none are selected" "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"
);
} }
}); });