DEV: refactors select-kit helper to prevent it to leak into global state (#7708)

DEV: refactors select-kit helper to prevent it to leak into global state (#7708)

diff --git a/.eslintrc b/.eslintrc
index e5a36ab..0086b7f 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -53,12 +53,6 @@
     "requirejs": true,
     "RSVP": true,
     "sandbox": true,
-    "selectKit": true,
-    "selectKitFillInFilter": true,
-    "selectKitSelectNoneRow": true,
-    "selectKitSelectRowByIndex": true,
-    "selectKitSelectRowByName": true,
-    "selectKitSelectRowByValue": true,
     "sinon": true,
     "test": true,
     "triggerEvent": true,
diff --git a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6 b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
index 08922bd..6119ef1 100644
--- a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
+++ b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js.es6
@@ -1,5 +1,6 @@
 import { acceptance } from "helpers/qunit-helpers";
 import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
+import selectKit from "helpers/select-kit-helper";
 
 acceptance("Details Button", {
   loggedIn: true,
diff --git a/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js.es6 b/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js.es6
index ba6bdcc..313f5b6 100644
--- a/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js.es6
+++ b/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js.es6
@@ -1,3 +1,5 @@
+import selectKit from "helpers/select-kit-helper";
+
 export function displayPollBuilderButton() {
   visit("/");
   click("#create-topic");
diff --git a/test/javascripts/acceptance/admin-suspend-user-test.js.es6 b/test/javascripts/acceptance/admin-suspend-user-test.js.es6
index a982bc7..152b035 100644
--- a/test/javascripts/acceptance/admin-suspend-user-test.js.es6
+++ b/test/javascripts/acceptance/admin-suspend-user-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 
 acceptance("Admin - Suspend User", {
diff --git a/test/javascripts/acceptance/category-chooser-test.js.es6 b/test/javascripts/acceptance/category-chooser-test.js.es6
index 83b1af2..b6772ab 100644
--- a/test/javascripts/acceptance/category-chooser-test.js.es6
+++ b/test/javascripts/acceptance/category-chooser-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 
 acceptance("CategoryChooser", {
diff --git a/test/javascripts/acceptance/category-edit-security-test.js.es6 b/test/javascripts/acceptance/category-edit-security-test.js.es6
index 6a4ca58..131b26f 100644
--- a/test/javascripts/acceptance/category-edit-security-test.js.es6
+++ b/test/javascripts/acceptance/category-edit-security-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 
 acceptance("Category Edit - security", {
diff --git a/test/javascripts/acceptance/category-edit-test.js.es6 b/test/javascripts/acceptance/category-edit-test.js.es6
index 825cd0e..690e028 100644
--- a/test/javascripts/acceptance/category-edit-test.js.es6
+++ b/test/javascripts/acceptance/category-edit-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import DiscourseURL from "discourse/lib/url";
 import { acceptance } from "helpers/qunit-helpers";
 
diff --git a/test/javascripts/acceptance/composer-actions-test.js.es6 b/test/javascripts/acceptance/composer-actions-test.js.es6
index b70d749..fd6eb58 100644
--- a/test/javascripts/acceptance/composer-actions-test.js.es6
+++ b/test/javascripts/acceptance/composer-actions-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
 import { _clearSnapshots } from "select-kit/components/composer-actions";
 import { toggleCheckDraftPopup } from "discourse/controllers/composer";
diff --git a/test/javascripts/acceptance/composer-test.js.es6 b/test/javascripts/acceptance/composer-test.js.es6
index b77866a..b055992 100644
--- a/test/javascripts/acceptance/composer-test.js.es6
+++ b/test/javascripts/acceptance/composer-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 import { toggleCheckDraftPopup } from "discourse/controllers/composer";
 
diff --git a/test/javascripts/acceptance/composer-uncategorized-test.js.es6 b/test/javascripts/acceptance/composer-uncategorized-test.js.es6
index bbcc67a..c65c759 100644
--- a/test/javascripts/acceptance/composer-uncategorized-test.js.es6
+++ b/test/javascripts/acceptance/composer-uncategorized-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
 
 acceptance("Composer and uncategorized is not allowed", {
diff --git a/test/javascripts/acceptance/dashboard-test.js.es6 b/test/javascripts/acceptance/dashboard-test.js.es6
index 1a7675d..affe6c0 100644
--- a/test/javascripts/acceptance/dashboard-test.js.es6
+++ b/test/javascripts/acceptance/dashboard-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 
 acceptance("Dashboard", {
diff --git a/test/javascripts/acceptance/group-test.js.es6 b/test/javascripts/acceptance/group-test.js.es6
index 3c73a89..3a0d371 100644
--- a/test/javascripts/acceptance/group-test.js.es6
+++ b/test/javascripts/acceptance/group-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance, logIn } from "helpers/qunit-helpers";
 
 acceptance("Group", {
@@ -48,7 +49,7 @@ QUnit.test("Anonymous Viewing Group", async assert => {
   );
   assert.ok(count(".user-stream-item") > 0, "it lists stream items");
 
-  await expandSelectKit(".group-dropdown");
+  await selectKit(".group-dropdown").expand();
 
   assert.equal(
     find(".select-kit-row")
@@ -70,7 +71,7 @@ QUnit.test("Anonymous Viewing Group", async assert => {
 
   await visit("/g");
   await visit("/g/discourse");
-  await expandSelectKit(".group-dropdown");
+  await selectKit(".group-dropdown").expand();
 
   assert.equal(
     find(".group-dropdown-filter").length,
diff --git a/test/javascripts/acceptance/new-topic-test.js.es6 b/test/javascripts/acceptance/new-topic-test.js.es6
index 1ad6fc0..b83d467 100644
--- a/test/javascripts/acceptance/new-topic-test.js.es6
+++ b/test/javascripts/acceptance/new-topic-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance, logIn } from "helpers/qunit-helpers";
 
 acceptance("New Topic");
diff --git a/test/javascripts/acceptance/preferences-test.js.es6 b/test/javascripts/acceptance/preferences-test.js.es6
index e181fca..ff4319e 100644
--- a/test/javascripts/acceptance/preferences-test.js.es6
+++ b/test/javascripts/acceptance/preferences-test.js.es6
@@ -1,3 +1,4 @@
+import selectKit from "helpers/select-kit-helper";
 import { acceptance } from "helpers/qunit-helpers";
 import User from "discourse/models/user";
 
@@ -114,12 +115,12 @@ QUnit.test("font size change", async assert => {
   await visit("/u/eviltrout/preferences/interface");
 
   // Live changes without reload
-  await expandSelectKit(".text-size .combobox");
-  await selectKitSelectRowByValue("larger", ".text-size .combobox");
+  await selectKit(".text-size .combobox").expand();
+  await selectKit(".text-size .combobox").selectRowByValue("larger");
   assert.ok(document.documentElement.classList.contains("text-size-larger"));
 
-  await expandSelectKit(".text-size .combobox");
-  await selectKitSelectRowByValue("largest", ".text-size .combobox");
+  await selectKit(".text-size .combobox").expand();
+  await selectKit(".text-size .combobox").selectRowByValue("largest");
   assert.ok(document.documentElement.classList.contains("text-size-largest"));
 
   assert.equal($.cookie("text_size"), null, "cookie is not set");

[... diff too long, it was truncated ...]

GitHub sha: b339d674

2 Likes