FIX: ensures category chooser is case insensitive (#9850)

FIX: ensures category chooser is case insensitive (#9850)

diff --git a/app/assets/javascripts/select-kit/addon/components/category-chooser.js b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
index f36e8be..72d0167 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-chooser.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
@@ -67,6 +67,7 @@ export default ComboBoxComponent.extend({
 
   search(filter) {
     if (filter) {
+      filter = filter.toLowerCase();
       return this.content.filter(item => {
         const category = Category.findById(this.getValue(item));
         const categoryName = this.getName(item);
diff --git a/test/javascripts/acceptance/category-chooser-test.js b/test/javascripts/acceptance/category-chooser-test.js
index b6772ab..2247c8c 100644
--- a/test/javascripts/acceptance/category-chooser-test.js
+++ b/test/javascripts/acceptance/category-chooser-test.js
@@ -29,3 +29,19 @@ QUnit.test("prefill category when category_id is set", async assert => {
     1
   );
 });
+
+QUnit.test("filter is case insensitive", async assert => {
+  const categoryChooser = selectKit(".category-chooser");
+
+  await visit("/");
+  await click("#create-topic");
+  await categoryChooser.expand();
+  await categoryChooser.fillInFilter("bug");
+
+  assert.ok(categoryChooser.rows().length, 1);
+
+  await categoryChooser.emptyFilter();
+  await categoryChooser.fillInFilter("Bug");
+
+  assert.ok(categoryChooser.rows().length, 1);
+});
diff --git a/test/javascripts/helpers/select-kit-helper.js b/test/javascripts/helpers/select-kit-helper.js
index 5d80b8f..f795991 100644
--- a/test/javascripts/helpers/select-kit-helper.js
+++ b/test/javascripts/helpers/select-kit-helper.js
@@ -32,6 +32,11 @@ async function selectKitFillInFilter(filter, selector) {
   );
 }
 
+async function selectKitEmptyFilter(selector) {
+  checkSelectKitIsNotCollapsed(selector);
+  await fillIn(`${selector} .filter-input`, "");
+}
+
 async function selectKitSelectRowByValue(value, selector) {
   checkSelectKitIsNotCollapsed(selector);
   await click(`${selector} .select-kit-row[data-value='${value}']`);
@@ -180,6 +185,10 @@ export default function selectKit(selector) {
       await selectKitFillInFilter(filter, selector);
     },
 
+    async emptyFilter() {
+      await selectKitEmptyFilter(selector);
+    },
+
     async keyboard(value, target) {
       await keyboardHelper(value, target, selector);
     },

GitHub sha: 66960563

This commit appears in #9850 which was merged by jjaffeux.