Navigation Menu

Skip to content

Commit

Permalink
FIX: ensures category chooser is case insensitive (#9850)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed May 21, 2020
1 parent 7b6fbe9 commit 6696056
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions test/javascripts/acceptance/category-chooser-test.js
Expand Up @@ -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);
});
9 changes: 9 additions & 0 deletions test/javascripts/helpers/select-kit-helper.js
Expand Up @@ -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}']`);
Expand Down Expand Up @@ -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);
},
Expand Down

0 comments on commit 6696056

Please sign in to comment.