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

This commit is contained in:
Joffrey JAFFEUX 2020-05-21 11:16:44 +02:00 committed by GitHub
parent 7b6fbe9af2
commit 66960563ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View File

@ -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);

View File

@ -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);
});

View File

@ -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);
},