Skip to content

A platform for community discussion. Free, open, simple.

DEV: Only patch bootbox methods once in tests (#19222)

David Taylor7e504a148955
diff --git a/app/assets/javascripts/discourse/app/initializers/jquery-plugins.js b/app/assets/javascripts/discourse/app/initializers/jquery-plugins.js
index e9844f8dee8..8302cf90bb1 100644
--- a/app/assets/javascripts/discourse/app/initializers/jquery-plugins.js
+++ b/app/assets/javascripts/discourse/app/initializers/jquery-plugins.js
@@ -3,9 +3,15 @@ import bootbox from "bootbox";
import { getOwner } from "discourse-common/lib/get-owner";
import deprecated from "discourse-common/lib/deprecated";
+let jqueryPluginsConfigured = false;
+
export default {
name: "jquery-plugins",
initialize() {
+ if (jqueryPluginsConfigured) {
+ return;
+ }
+
// Settings for bootbox
bootbox.animate(false);
bootbox.backdrop(true);
@@ -46,5 +52,7 @@ export default {
// Initialize the autocomplete tool
$.fn.autocomplete = autocomplete;
+
+ jqueryPluginsConfigured = true;
},
};