mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:33:51 +08:00
FIX: ensures category chooser is case insensitive (#9850)
This commit is contained in:
parent
7b6fbe9af2
commit
66960563ea
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user