diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-01-13 11:12:44 -0500 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-01-16 12:18:59 -0500 |
commit | f0ed80a234c75585685625c7c125cdd0fb832978 (patch) | |
tree | 4a64563f2ec77e10bbe74c8a5e426c99f5de988e | |
parent | 6c1190623fb4d69786efb955b3af0b9241974776 (diff) | |
download | gitlab-ce-f0ed80a234c75585685625c7c125cdd0fb832978.tar.gz |
Fix dropdown filter input value after blur26616-fix-search-group-project-filters
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 2 | ||||
-rw-r--r-- | changelogs/unreleased/26616-fix-search-group-project-filters.yml | 4 | ||||
-rw-r--r-- | spec/javascripts/gl_dropdown_spec.js.es6 | 19 |
4 files changed, 25 insertions, 2 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index ceeffa8e6d1..e2d7f94e571 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -892,7 +892,7 @@ DEPENDENCIES gemojione (~> 3.0) github-linguist (~> 4.7.0) gitlab-flowdock-git-hook (~> 1.0.1) - gitlab-markup (~> 1.5.0) + gitlab-markup (~> 1.5.1) gitlab-turbolinks-classic (~> 2.5, >= 2.5.6) gitlab_omniauth-ldap (~> 1.2.1) gollum-lib (~> 4.2) diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index bb516b3d2df..00859728c30 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -476,7 +476,7 @@ this.removeArrayKeyEvent(); $input = this.dropdown.find(".dropdown-input-field"); if (this.options.filterable) { - $input.blur().val(""); + $input.blur(); } if (this.dropdown.find(".dropdown-toggle-page").length) { $('.dropdown-menu', this.dropdown).removeClass(PAGE_TWO_CLASS); diff --git a/changelogs/unreleased/26616-fix-search-group-project-filters.yml b/changelogs/unreleased/26616-fix-search-group-project-filters.yml new file mode 100644 index 00000000000..0fd0dbbfc24 --- /dev/null +++ b/changelogs/unreleased/26616-fix-search-group-project-filters.yml @@ -0,0 +1,4 @@ +--- +title: Fix search group/project filtering to show results +merge_request: +author: diff --git a/spec/javascripts/gl_dropdown_spec.js.es6 b/spec/javascripts/gl_dropdown_spec.js.es6 index ce96571bd52..d11b1182d9a 100644 --- a/spec/javascripts/gl_dropdown_spec.js.es6 +++ b/spec/javascripts/gl_dropdown_spec.js.es6 @@ -50,6 +50,9 @@ selectable: true, filterable: isFilterable, data: hasRemote ? remoteMock.bind({}, this.projectsData) : this.projectsData, + search: { + fields: ['name'] + }, text: (project) => { (project.name_with_namespace || project.name); }, @@ -167,5 +170,21 @@ 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'); + }); }); })(); |