2019-09-11 19:25:06 -04:00
|
|
|
import componentTest from "helpers/component-test";
|
|
|
|
|
|
|
|
moduleForComponent("stripe-card", { integration: true });
|
|
|
|
|
|
|
|
componentTest("Discourse Patrons stripe card success", {
|
2019-09-12 04:51:40 -04:00
|
|
|
template: `{{stripe-card handleConfirmStripeCard=onSubmit billing=billing}}`,
|
2019-09-11 19:25:06 -04:00
|
|
|
|
|
|
|
beforeEach() {
|
|
|
|
window.Stripe = () => {
|
|
|
|
return {
|
|
|
|
createPaymentMethod() {
|
|
|
|
return new Ember.RSVP.Promise(resolve => {
|
|
|
|
resolve({});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
elements() {
|
|
|
|
return {
|
|
|
|
create() {
|
|
|
|
return {
|
|
|
|
on() {},
|
|
|
|
card() {},
|
|
|
|
mount() {}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
2019-09-12 04:51:40 -04:00
|
|
|
|
|
|
|
this.set(
|
|
|
|
"billing",
|
|
|
|
Ember.Object.create({
|
|
|
|
name: "",
|
|
|
|
email: "",
|
|
|
|
phone: ""
|
|
|
|
})
|
|
|
|
);
|
2019-09-11 19:25:06 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
async test(assert) {
|
|
|
|
assert.expect(1);
|
|
|
|
|
|
|
|
this.set("onSubmit", () => {
|
|
|
|
assert.ok(true, "payment method created");
|
|
|
|
});
|
|
|
|
|
|
|
|
await click(".btn-payment");
|
|
|
|
}
|
|
|
|
});
|