1
0
mirror of synced 2026-05-22 18:53:16 +00:00

test button click

This commit is contained in:
Rimian Perkins
2019-12-06 14:33:38 +11:00
parent 2ce314fc8d
commit d3eed3546d
5 changed files with 43 additions and 13 deletions
@@ -2,28 +2,28 @@ import componentTest from "helpers/component-test";
moduleForComponent("payment-options", { integration: true });
componentTest("Discourse Subscriptions has no plans", {
componentTest("Discourse Subscriptions payment options have no plans", {
template: `{{payment-options plans=plans}}`,
async test(assert) {
this.set('plans', false);
this.set("plans", false);
assert.equal(
find("#subscribe-buttons .btn-discourse-subscriptions-subscribe").length,
find(".btn-discourse-subscriptions-subscribe").length,
0,
"The plan buttons are not shown"
);
}
});
componentTest("Discourse Subscriptions has content", {
componentTest("Discourse Subscriptions payment options has content", {
template: `{{payment-options plans=plans}}`,
async test(assert) {
this.set('plans', [1, 2]);
this.set("plans", [1, 2]);
assert.equal(
find("#subscribe-buttons .btn-discourse-subscriptions-subscribe").length,
find(".btn-discourse-subscriptions-subscribe").length,
2,
"The plan buttons are shown"
);
@@ -34,3 +34,20 @@ componentTest("Discourse Subscriptions has content", {
);
}
});
componentTest("Discourse Subscriptions payment options plan is selected", {
template: `{{payment-options plans=plans selectPlan=selectPlan}}`,
beforeEach() {},
async test(assert) {
assert.expect(1);
this.set("plans", [1, 2]);
this.set("selectPlan", function(plan) {
assert.equal(plan, 1, "the plan is selected");
});
await click(".btn-discourse-subscriptions-subscribe:first-child");
}
});