Commit ce588f38 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '208171-clicking-on-search-results-does-not-follow-link' into 'master'

Prevent an issue where dropdown links would not be clickable

See merge request gitlab-org/gitlab!30087
parents d9f5ff18 a5a339b7
...@@ -407,7 +407,7 @@ export class SearchAutocomplete { ...@@ -407,7 +407,7 @@ export class SearchAutocomplete {
disableAutocomplete() { disableAutocomplete() {
if (!this.searchInput.hasClass('js-autocomplete-disabled') && this.dropdown.hasClass('show')) { if (!this.searchInput.hasClass('js-autocomplete-disabled') && this.dropdown.hasClass('show')) {
this.searchInput.addClass('js-autocomplete-disabled'); this.searchInput.addClass('js-autocomplete-disabled');
this.dropdown.dropdown('toggle'); this.dropdownToggle.dropdown('toggle');
this.restoreMenu(); this.restoreMenu();
} }
} }
......
---
title: Fix an issue where the Search dropdown results would not be clickable.
merge_request: 30087
author: mbergeron
type: fixed
...@@ -188,4 +188,28 @@ describe('Search autocomplete dropdown', () => { ...@@ -188,4 +188,28 @@ describe('Search autocomplete dropdown', () => {
// example) on JavaScript-created keypresses. // example) on JavaScript-created keypresses.
expect(submitSpy).not.toHaveBeenTriggered(); expect(submitSpy).not.toHaveBeenTriggered();
}); });
describe('disableAutocomplete', function() {
beforeEach(function() {
widget.enableAutocomplete();
});
it('should close the Dropdown', function() {
const toggleSpy = spyOn(widget.dropdownToggle, 'dropdown');
widget.dropdown.addClass('show');
widget.disableAutocomplete();
expect(toggleSpy).toHaveBeenCalledWith('toggle');
});
});
describe('enableAutocomplete', function() {
it('should open the Dropdown', function() {
const toggleSpy = spyOn(widget.dropdownToggle, 'dropdown');
widget.enableAutocomplete();
expect(toggleSpy).toHaveBeenCalledWith('toggle');
});
});
}); });
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