BigW Consortium Gitlab

Commit fad89f37 by Alfredo Sumaran Committed by James Lopez

Merge branch '26616-fix-search-group-project-filters' into 'master'

Fix search group/project filtering to show results Closes #26616 See merge request !8565
parent 9c399c6e
...@@ -476,7 +476,7 @@ ...@@ -476,7 +476,7 @@
this.removeArrayKeyEvent(); this.removeArrayKeyEvent();
$input = this.dropdown.find(".dropdown-input-field"); $input = this.dropdown.find(".dropdown-input-field");
if (this.options.filterable) { if (this.options.filterable) {
$input.blur().val(""); $input.blur();
} }
if (this.dropdown.find(".dropdown-toggle-page").length) { if (this.dropdown.find(".dropdown-toggle-page").length) {
$('.dropdown-menu', this.dropdown).removeClass(PAGE_TWO_CLASS); $('.dropdown-menu', this.dropdown).removeClass(PAGE_TWO_CLASS);
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
selectable: true, selectable: true,
filterable: true, filterable: true,
fieldName: 'group_id', fieldName: 'group_id',
search: {
fields: ['name']
},
data: function(term, callback) { data: function(term, callback) {
return Api.groups(term, {}, function(data) { return Api.groups(term, {}, function(data) {
data.unshift({ data.unshift({
...@@ -40,6 +43,9 @@ ...@@ -40,6 +43,9 @@
selectable: true, selectable: true,
filterable: true, filterable: true,
fieldName: 'project_id', fieldName: 'project_id',
search: {
fields: ['name']
},
data: function(term, callback) { data: function(term, callback) {
return Api.projects(term, 'id', function(data) { return Api.projects(term, 'id', function(data) {
data.unshift({ data.unshift({
......
---
title: Fix search group/project filtering to show results
merge_request:
author:
...@@ -50,6 +50,9 @@ ...@@ -50,6 +50,9 @@
selectable: true, selectable: true,
filterable: isFilterable, filterable: isFilterable,
data: hasRemote ? remoteMock.bind({}, this.projectsData) : this.projectsData, data: hasRemote ? remoteMock.bind({}, this.projectsData) : this.projectsData,
search: {
fields: ['name']
},
text: (project) => { text: (project) => {
(project.name_with_namespace || project.name); (project.name_with_namespace || project.name);
}, },
...@@ -167,5 +170,21 @@ ...@@ -167,5 +170,21 @@
expect($(document.activeElement)).toEqual($(SEARCH_INPUT_SELECTOR)); expect($(document.activeElement)).toEqual($(SEARCH_INPUT_SELECTOR));
}); });
}); });
it('should still have input value on close and restore', () => {
let $searchInput = $(SEARCH_INPUT_SELECTOR);
initDropDown.call(this, false, true);
$searchInput
.trigger('focus')
.val('g')
.trigger('input');
expect($searchInput.val()).toEqual('g');
this.dropdownButtonElement.trigger('hidden.bs.dropdown');
$searchInput
.trigger('blur')
.trigger('focus');
expect($searchInput.val()).toEqual('g');
});
}); });
})(); })();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment