diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-10-24 19:49:01 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-11-06 21:30:18 +0100 |
commit | d4a9aedf55793670e40b570b10a1aae6a805d956 (patch) | |
tree | aae221b92ce3ae3fbce416b8cae775348ebd7019 /spec/javascripts/search_autocomplete_spec.js | |
parent | 15e3d337610d99aa13ee8d52267573e8dc0b73d9 (diff) | |
download | gitlab-ce-d4a9aedf55793670e40b570b10a1aae6a805d956.tar.gz |
Fixes 404 error to `Issues assigned to me` and `Issues I've created` when issues are disabled
The dropdown options `Issues assigned to me` and `Issues I've created` in project search are now
hidden when issues are disabled on the project.
Diffstat (limited to 'spec/javascripts/search_autocomplete_spec.js')
-rw-r--r-- | spec/javascripts/search_autocomplete_spec.js | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index cf811af3d6c..f3006f5d742 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -58,6 +58,10 @@ import 'vendor/fuzzaldrin-plus'; } }; + const disableProjectIssues = function() { + document.querySelector('.js-search-project-options').setAttribute('data-issues-disabled', true); + }; + // Mock `gl` object in window for dashboard specific page. App code will need it. mockDashboardOptions = function() { window.gl || (window.gl = {}); @@ -92,18 +96,20 @@ import 'vendor/fuzzaldrin-plus'; assertLinks = function(list, issuesPath, mrsPath) { var a1, a2, a3, a4, issuesAssignedToMeLink, issuesIHaveCreatedLink, mrsAssignedToMeLink, mrsIHaveCreatedLink; - issuesAssignedToMeLink = issuesPath + "/?assignee_username=" + userName; - issuesIHaveCreatedLink = issuesPath + "/?author_username=" + userName; + if (issuesPath) { + issuesAssignedToMeLink = issuesPath + "/?assignee_username=" + userName; + issuesIHaveCreatedLink = issuesPath + "/?author_username=" + userName; + a1 = "a[href='" + issuesAssignedToMeLink + "']"; + a2 = "a[href='" + issuesIHaveCreatedLink + "']"; + expect(list.find(a1).length).toBe(1); + expect(list.find(a1).text()).toBe('Issues assigned to me'); + expect(list.find(a2).length).toBe(1); + expect(list.find(a2).text()).toBe("Issues I've created"); + } mrsAssignedToMeLink = mrsPath + "/?assignee_username=" + userName; mrsIHaveCreatedLink = mrsPath + "/?author_username=" + userName; - a1 = "a[href='" + issuesAssignedToMeLink + "']"; - a2 = "a[href='" + issuesIHaveCreatedLink + "']"; a3 = "a[href='" + mrsAssignedToMeLink + "']"; a4 = "a[href='" + mrsIHaveCreatedLink + "']"; - expect(list.find(a1).length).toBe(1); - expect(list.find(a1).text()).toBe('Issues assigned to me'); - expect(list.find(a2).length).toBe(1); - expect(list.find(a2).text()).toBe("Issues I've created"); expect(list.find(a3).length).toBe(1); expect(list.find(a3).text()).toBe('Merge requests assigned to me'); expect(list.find(a4).length).toBe(1); @@ -154,6 +160,14 @@ import 'vendor/fuzzaldrin-plus'; list = widget.wrap.find('.dropdown-menu').find('ul'); return assertLinks(list, projectIssuesPath, projectMRsPath); }); + it('should show only Project mergeRequest dropdown menu items when project issues are disabled', function() { + addBodyAttributes('project'); + disableProjectIssues(); + mockProjectOptions(); + widget.searchInput.triggerHandler('focus'); + const list = widget.wrap.find('.dropdown-menu').find('ul'); + assertLinks(list, null, projectMRsPath); + }); it('should not show category related menu if there is text in the input', function() { var link, list; addBodyAttributes('project'); |