summaryrefslogtreecommitdiff
path: root/spec/javascripts/search_autocomplete_spec.js
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-01-09 16:33:56 -0600
committerMike Greiling <mike@pixelcog.com>2017-01-10 12:30:45 -0600
commitd2649bf8e3d55e28e453f891faa92745267affe5 (patch)
tree079a9f6d24de3634ddc83914c39817af7870b30d /spec/javascripts/search_autocomplete_spec.js
parent5ffbb5dee58dcc5541a06a17700c87b62c4c31d8 (diff)
downloadgitlab-ce-d2649bf8e3d55e28e453f891faa92745267affe5.tar.gz
bypass Chrome "focus" event bugs and prevent Turbolinks from triggering
Diffstat (limited to 'spec/javascripts/search_autocomplete_spec.js')
-rw-r--r--spec/javascripts/search_autocomplete_spec.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js
index 08d9b775940..d564a49517b 100644
--- a/spec/javascripts/search_autocomplete_spec.js
+++ b/spec/javascripts/search_autocomplete_spec.js
@@ -112,13 +112,15 @@ require('vendor/fuzzaldrin-plus');
preloadFixtures('static/search_autocomplete.html.raw');
beforeEach(function() {
loadFixtures('static/search_autocomplete.html.raw');
- return widget = new gl.SearchAutocomplete;
+ widget = new gl.SearchAutocomplete;
+ // Prevent turbolinks from triggering within gl_dropdown
+ spyOn(window.Turbolinks, 'visit').and.returnValue(true);
});
it('should show Dashboard specific dropdown menu', function() {
var list;
addBodyAttributes();
mockDashboardOptions();
- widget.searchInput.focus();
+ widget.searchInput.triggerHandler('focus');
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, dashboardIssuesPath, dashboardMRsPath);
});
@@ -126,7 +128,7 @@ require('vendor/fuzzaldrin-plus');
var list;
addBodyAttributes('group');
mockGroupOptions();
- widget.searchInput.focus();
+ widget.searchInput.triggerHandler('focus');
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, groupIssuesPath, groupMRsPath);
});
@@ -134,7 +136,7 @@ require('vendor/fuzzaldrin-plus');
var list;
addBodyAttributes('project');
mockProjectOptions();
- widget.searchInput.focus();
+ widget.searchInput.triggerHandler('focus');
list = widget.wrap.find('.dropdown-menu').find('ul');
return assertLinks(list, projectIssuesPath, projectMRsPath);
});
@@ -143,7 +145,7 @@ require('vendor/fuzzaldrin-plus');
addBodyAttributes('project');
mockProjectOptions();
widget.searchInput.val('help');
- widget.searchInput.focus();
+ widget.searchInput.triggerHandler('focus');
list = widget.wrap.find('.dropdown-menu').find('ul');
link = "a[href='" + projectIssuesPath + "/?assignee_id=" + userId + "']";
return expect(list.find(link).length).toBe(0);
@@ -154,7 +156,7 @@ require('vendor/fuzzaldrin-plus');
addBodyAttributes();
mockDashboardOptions(true);
var submitSpy = spyOnEvent('form', 'submit');
- widget.searchInput.focus();
+ widget.searchInput.triggerHandler('focus');
widget.wrap.trigger($.Event('keydown', { which: DOWN }));
var enterKeyEvent = $.Event('keydown', { which: ENTER });
widget.searchInput.trigger(enterKeyEvent);