mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Disabled stripe-cards input if a already registred card is select
And then re-enabled it, if use decide to register a new card
This commit is contained in:
@@ -13,7 +13,9 @@ describe("StripeCardsController", () => {
|
||||
<option value="1">Card #1</option>
|
||||
<option value="2">Card #2</option>
|
||||
</select>
|
||||
<div data-stripe-cards-target="stripeelements" id="stripeelements" />
|
||||
<div data-stripe-cards-target="stripeelements" id="stripeelements" >
|
||||
<input type="hidden" id="input_1">
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
const application = Application.start();
|
||||
@@ -38,18 +40,21 @@ describe("StripeCardsController", () => {
|
||||
expect(document.getElementById("stripeelements").style.display).toBe(
|
||||
"none"
|
||||
);
|
||||
expect(document.getElementById("input_1").disabled).toBe(true);
|
||||
|
||||
select.value = "2";
|
||||
select.dispatchEvent(new Event("change"));
|
||||
expect(document.getElementById("stripeelements").style.display).toBe(
|
||||
"none"
|
||||
);
|
||||
expect(document.getElementById("input_1").disabled).toBe(true);
|
||||
|
||||
select.value = "";
|
||||
select.dispatchEvent(new Event("change"));
|
||||
expect(document.getElementById("stripeelements").style.display).toBe(
|
||||
"block"
|
||||
);
|
||||
expect(document.getElementById("input_1").disabled).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user