diff --git a/spec/javascripts/stimulus/paymentmethod_controller_test.js b/spec/javascripts/stimulus/paymentmethod_controller_test.js
index 09180ac066..b81dbbf605 100644
--- a/spec/javascripts/stimulus/paymentmethod_controller_test.js
+++ b/spec/javascripts/stimulus/paymentmethod_controller_test.js
@@ -6,13 +6,18 @@ import { Application } from "stimulus";
import paymentmethod_controller from "../../../app/webpacker/controllers/paymentmethod_controller";
describe("PaymentmethodController", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("paymentmethod", paymentmethod_controller);
+ });
+
describe("#selectPaymentMethod", () => {
beforeEach(() => {
document.body.innerHTML = `
`;
-
- const application = Application.start();
- application.register("paymentmethod", paymentmethod_controller);
});
it("fill the right payment container", () => {
diff --git a/spec/javascripts/stimulus/remote_toggle_controller_test.js b/spec/javascripts/stimulus/remote_toggle_controller_test.js
index e46a0b61fe..507ce3827d 100644
--- a/spec/javascripts/stimulus/remote_toggle_controller_test.js
+++ b/spec/javascripts/stimulus/remote_toggle_controller_test.js
@@ -6,6 +6,11 @@ import { Application } from "stimulus";
import remote_toggle_controller from "../../../app/webpacker/controllers/remote_toggle_controller";
describe("RemoteToggleController", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("remote-toggle", remote_toggle_controller);
+ });
+
describe("#toggle", () => {
beforeEach(() => {
document.body.innerHTML = `
@@ -17,9 +22,6 @@ describe("RemoteToggleController", () => {
...
`;
-
- const application = Application.start();
- application.register("remote-toggle", remote_toggle_controller);
});
it("clicking a toggle switches the visibility of the :data-remote-toggle-selector element", () => {
@@ -36,8 +38,7 @@ describe("RemoteToggleController", () => {
expect(content.style.display).toBe("block");
});
- /* skipping, this test passes when it's the only test in this file but not otherwise? */
- it.skip("clicking a toggle with a chevron icon switches the visibility of content and the direction of the icon", () => {
+ it("clicking a toggle with a chevron icon switches the visibility of content and the direction of the icon", () => {
const button = document.getElementById("remote-toggle-with-chevron");
const chevron = button.querySelector("i");
const content = document.getElementById("content");
diff --git a/spec/javascripts/stimulus/stripe_cards_controller_test.js b/spec/javascripts/stimulus/stripe_cards_controller_test.js
index 44679a1e81..36d74ea314 100644
--- a/spec/javascripts/stimulus/stripe_cards_controller_test.js
+++ b/spec/javascripts/stimulus/stripe_cards_controller_test.js
@@ -6,6 +6,11 @@ import { Application } from "stimulus";
import stripe_cards_controller from "../../../app/webpacker/controllers/stripe_cards_controller";
describe("StripeCardsController", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("stripe-cards", stripe_cards_controller);
+ });
+
beforeEach(() => {
document.body.innerHTML = `
@@ -17,9 +22,6 @@ describe("StripeCardsController", () => {
`;
-
- const application = Application.start();
- application.register("stripe-cards", stripe_cards_controller);
});
describe("#connect", () => {
it("initialize with the right display state", () => {
diff --git a/spec/javascripts/stimulus/tabs_controller_test.js b/spec/javascripts/stimulus/tabs_controller_test.js
index a67296bd0b..fa4ab5d737 100644
--- a/spec/javascripts/stimulus/tabs_controller_test.js
+++ b/spec/javascripts/stimulus/tabs_controller_test.js
@@ -6,6 +6,11 @@ import { Application } from "stimulus";
import tabs_controller from "../../../app/webpacker/controllers/tabs_controller";
describe("TabsController", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("tabs", tabs_controller);
+ });
+
describe("#select", () => {
beforeEach(() => {
document.body.innerHTML = `
@@ -13,7 +18,7 @@ describe("TabsController", () => {
Dogs
Cats
Birds
-
+
Dogs content
@@ -25,9 +30,6 @@ describe("TabsController", () => {
`;
-
- const application = Application.start();
- application.register("tabs", tabs_controller);
});
it("shows the corresponding content when a tab button is clicked", () => {
diff --git a/spec/javascripts/stimulus/toggle_controller_test.js b/spec/javascripts/stimulus/toggle_controller_test.js
index 7dcd527e16..c60669d1b8 100644
--- a/spec/javascripts/stimulus/toggle_controller_test.js
+++ b/spec/javascripts/stimulus/toggle_controller_test.js
@@ -6,6 +6,11 @@ import { Application } from "stimulus";
import toggle_controller from "../../../app/webpacker/controllers/toggle_controller";
describe("ToggleController", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("toggle", toggle_controller);
+ });
+
describe("#toggle", () => {
beforeEach(() => {
document.body.innerHTML = `
@@ -14,9 +19,6 @@ describe("ToggleController", () => {
content
`;
-
- const application = Application.start();
- application.register("toggle", toggle_controller);
});
it("toggle the content", () => {
diff --git a/spec/javascripts/stimulus/update_controller_test.js b/spec/javascripts/stimulus/update_controller_test.js
index 33c85645c7..a6c4463944 100644
--- a/spec/javascripts/stimulus/update_controller_test.js
+++ b/spec/javascripts/stimulus/update_controller_test.js
@@ -6,15 +6,17 @@ import { Application } from "stimulus";
import updateinput_controller from "../../../app/webpacker/controllers/updateinput_controller";
describe("updateInput controller", () => {
+ beforeAll(() => {
+ const application = Application.start();
+ application.register("updateinput", updateinput_controller);
+ });
+
describe("#update", () => {
beforeEach(() => {
document.body.innerHTML = ``;
-
- const application = Application.start();
- application.register("updateinput", updateinput_controller);
});
it("update the input value", () => {