refactor(payment): unify method selector visibility
This commit is contained in:
@@ -7,8 +7,11 @@ describe("PaymentMethodSelector", () => {
|
||||
it("orders the default channel first and renders page analytics", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<PaymentMethodSelector
|
||||
config={{
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "ezpay",
|
||||
}}
|
||||
value="ezpay"
|
||||
defaultChannel="ezpay"
|
||||
caption="GCash by default"
|
||||
analyticsKey="tip.payment_method"
|
||||
onChange={() => undefined}
|
||||
@@ -40,6 +43,10 @@ describe("PaymentMethodSelector", () => {
|
||||
it("disables both payment methods while payment is busy", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<PaymentMethodSelector
|
||||
config={{
|
||||
canChoosePaymentMethod: true,
|
||||
initialPayChannel: "stripe",
|
||||
}}
|
||||
value="stripe"
|
||||
disabled
|
||||
analyticsKey="subscription.payment_method"
|
||||
@@ -52,4 +59,20 @@ describe("PaymentMethodSelector", () => {
|
||||
'data-analytics-key="subscription.payment_method"',
|
||||
);
|
||||
});
|
||||
|
||||
it("does not render when payment method selection is unavailable", () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<PaymentMethodSelector
|
||||
config={{
|
||||
canChoosePaymentMethod: false,
|
||||
initialPayChannel: "stripe",
|
||||
}}
|
||||
value="stripe"
|
||||
analyticsKey="tip.payment_method"
|
||||
onChange={() => undefined}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user