Commit 3e01d664 authored by Coung Ngo's avatar Coung Ngo

Reset labels select search text on Enter

The labels select Vue component did not match the previous
functionality where pressing Enter after selecting a label
in the dropdown clears the search text.
parent 23910d26
......@@ -112,6 +112,7 @@ export default {
this.currentHighlightItem += 1;
} else if (e.keyCode === ENTER_KEY_CODE && this.currentHighlightItem > -1) {
this.updateSelectedLabels([this.visibleLabels[this.currentHighlightItem]]);
this.searchKey = '';
} else if (e.keyCode === ESC_KEY_CODE) {
this.toggleDropdownContents();
}
......
---
title: Reset labels select search text on Enter
merge_request: 43285
author:
type: fixed
......@@ -133,6 +133,19 @@ describe('DropdownContentsLabelsView', () => {
expect(wrapper.vm.currentHighlightItem).toBe(2);
});
it('resets the search text when the Enter key is pressed', () => {
wrapper.setData({
currentHighlightItem: 1,
searchKey: 'bug',
});
wrapper.vm.handleKeyDown({
keyCode: ENTER_KEY_CODE,
});
expect(wrapper.vm.searchKey).toBe('');
});
it('calls action `updateSelectedLabels` with currently highlighted label when Enter key is pressed', () => {
jest.spyOn(wrapper.vm, 'updateSelectedLabels').mockImplementation();
wrapper.setData({
......
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