Files
discourse-subscriptions/test/javascripts/components/payment-options-test.js.es6
T

44 lines
1009 B
JavaScript
Raw Normal View History

import componentTest from "discourse/tests/helpers/component-test";
2019-12-06 13:52:03 +11:00
moduleForComponent("payment-options", { integration: true });
2019-12-06 14:33:38 +11:00
componentTest("Discourse Subscriptions payment options have no plans", {
2019-12-06 13:52:03 +11:00
template: `{{payment-options plans=plans}}`,
async test(assert) {
2019-12-06 14:33:38 +11:00
this.set("plans", false);
2019-12-06 13:52:03 +11:00
assert.equal(
2019-12-06 14:33:38 +11:00
find(".btn-discourse-subscriptions-subscribe").length,
2019-12-06 13:52:03 +11:00
0,
"The plan buttons are not shown"
);
},
2019-12-06 13:52:03 +11:00
});
2019-12-06 14:33:38 +11:00
componentTest("Discourse Subscriptions payment options has content", {
2019-12-17 21:14:13 +11:00
template: `{{payment-options
plans=plans
selectedPlan=selectedPlan
}}`,
2019-12-06 13:52:03 +11:00
2019-12-17 21:14:13 +11:00
beforeEach() {
2019-12-09 10:30:34 +11:00
this.set("plans", [
{
currency: "aud",
recurring: { interval: "year" },
amountDollars: "44.99",
},
{
currency: "gdp",
recurring: { interval: "month" },
amountDollars: "9.99",
},
2019-12-09 10:30:34 +11:00
]);
2019-12-17 21:14:13 +11:00
},
2019-12-17 21:14:13 +11:00
async test(assert) {
assert.equal(this.selectedPlan, null, "No plans are selected by default");
},
2019-12-06 14:33:38 +11:00
});