Merge branch '38167-ui-bug-when-creating-new-branch' into 'master'
[FIX] Fixed bug in dropdown selector when selecting the same selection again Closes #38167 and #37893 See merge request gitlab-org/gitlab-ce!14631
This commit is contained in:
commit
38c11bf84a
4 changed files with 33 additions and 2 deletions
|
@ -753,7 +753,7 @@ GitLabDropdown = (function() {
|
|||
}
|
||||
|
||||
if (this.options.isSelectable && !this.options.isSelectable(selectedObject, el)) {
|
||||
return;
|
||||
return [selectedObject];
|
||||
}
|
||||
|
||||
if (el.hasClass(ACTIVE_CLASS) && value !== 0) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fixed bug in dropdown selector when selecting the same selection again
|
||||
merge_request: 14631
|
||||
author: bitsapien
|
||||
type: fixed
|
|
@ -1,7 +1,8 @@
|
|||
%div
|
||||
.dropdown.inline
|
||||
%button#js-project-dropdown.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}}
|
||||
Projects
|
||||
.dropdown-toggle-text
|
||||
Projects
|
||||
%i.fa.fa-chevron-down.dropdown-toggle-caret.js-projects-dropdown-toggle
|
||||
.dropdown-menu.dropdown-select.dropdown-menu-selectable
|
||||
.dropdown-title
|
||||
|
|
|
@ -256,4 +256,29 @@ describe('glDropdown', function describeDropdown() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should keep selected item after selecting a second time', () => {
|
||||
const options = {
|
||||
isSelectable(item, $el) {
|
||||
return !$el.hasClass('is-active');
|
||||
},
|
||||
toggleLabel(item) {
|
||||
return item && item.id;
|
||||
},
|
||||
};
|
||||
initDropDown.call(this, false, false, options);
|
||||
const $item = $(`${ITEM_SELECTOR}:first() a`, this.$dropdownMenuElement);
|
||||
|
||||
// select item the first time
|
||||
this.dropdownButtonElement.click();
|
||||
$item.click();
|
||||
expect($item).toHaveClass('is-active');
|
||||
// select item the second time
|
||||
this.dropdownButtonElement.click();
|
||||
$item.click();
|
||||
expect($item).toHaveClass('is-active');
|
||||
|
||||
expect($('.dropdown-toggle-text')).toHaveText(this.projectsData[0].id.toString());
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue