Commit e2bf573d authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'cngo-clear-label-select-on-enter' into 'master'

Reset labels select search text on Enter

See merge request gitlab-org/gitlab!43285
parents 2c8a6a5e 3e01d664
......@@ -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