toggle single payments allowed setting
This commit is contained in:
@@ -17,16 +17,22 @@ componentTest("Discourse Subscriptions payment options have no plans", {
|
||||
});
|
||||
|
||||
componentTest("Discourse Subscriptions payment options has content", {
|
||||
template: `{{payment-options plans=plans planTypeIsSelected=planTypeIsSelected}}`,
|
||||
template: `{{payment-options
|
||||
paymentsAllowed=paymentsAllowed
|
||||
plans=plans
|
||||
planTypeIsSelected=planTypeIsSelected}}`,
|
||||
|
||||
async test(assert) {
|
||||
beforeEach() {
|
||||
this.set("plans", [
|
||||
{ currency: "aud", interval: "year", amountDollars: "44.99" },
|
||||
{ currency: "gdp", interval: "month", amountDollars: "9.99" }
|
||||
]);
|
||||
|
||||
this.set("planTypeIsSelected", true);
|
||||
this.set("paymentsAllowed", true);
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
assert.equal(
|
||||
find(".btn-discourse-subscriptions-payment-type").length,
|
||||
2,
|
||||
@@ -59,14 +65,46 @@ componentTest("Discourse Subscriptions payment options has content", {
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("Discourse Subscriptions payments allowed setting", {
|
||||
template: `{{payment-options plans=plans paymentsAllowed=paymentsAllowed}}`,
|
||||
|
||||
async test(assert) {
|
||||
this.set("paymentsAllowed", true);
|
||||
|
||||
assert.ok(
|
||||
find("#discourse-subscriptions-payment-type-plan").length,
|
||||
"The plan type button displayed"
|
||||
);
|
||||
assert.ok(
|
||||
find("#discourse-subscriptions-payment-type-payment").length,
|
||||
"The payment type button displayed"
|
||||
);
|
||||
|
||||
this.set("paymentsAllowed", false);
|
||||
|
||||
assert.notOk(
|
||||
find("#discourse-subscriptions-payment-type-plan").length,
|
||||
"The plan type button hidden"
|
||||
);
|
||||
assert.notOk(
|
||||
find("#discourse-subscriptions-payment-type-payment").length,
|
||||
"The payment type button hidden"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
componentTest("Discourse Subscriptions payment type plan", {
|
||||
template: `{{payment-options plans=plans planTypeIsSelected=planTypeIsSelected}}`,
|
||||
template: `{{payment-options
|
||||
paymentsAllowed=paymentsAllowed
|
||||
plans=plans
|
||||
planTypeIsSelected=planTypeIsSelected}}`,
|
||||
|
||||
async test(assert) {
|
||||
this.set("plans", [
|
||||
{ currency: "aud", interval: "year", amountDollars: "44.99" }
|
||||
]);
|
||||
|
||||
this.set("paymentsAllowed", true);
|
||||
this.set("planTypeIsSelected", true);
|
||||
|
||||
assert.equal(
|
||||
|
||||
Reference in New Issue
Block a user