diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-11-02 09:20:22 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-11-02 09:20:22 +0000 |
commit | 816700949028c556457d03fe134810ada2913eb7 (patch) | |
tree | 1e62fc92b1c83d657ff059f8b8d8195e2d460d8c | |
parent | 0ae4eb035d90964af0ed29ce2b457b76486f0fda (diff) | |
parent | bd872bb83f87c3194ca0e38cfc34b4fc682e2108 (diff) | |
download | gitlab-ce-816700949028c556457d03fe134810ada2913eb7.tar.gz |
Merge branch '52548-links-in-tabs-of-the-labels-index-pages-ends-with-html' into 'master'
Resolve "Links in tabs of the labels index pages ends with `.html`"
Closes #52548
See merge request gitlab-org/gitlab-ce!22716
-rw-r--r-- | app/helpers/labels_helper.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml | 5 | ||||
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 25 |
3 files changed, 31 insertions, 1 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 76ed8efe2c6..39f661b5f0c 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -143,7 +143,7 @@ module LabelsHelper def labels_filter_path(options = {}) project = @target_project || @project - format = options.delete(:format) || :html + format = options.delete(:format) if project project_labels_path(project, format, options) diff --git a/changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml b/changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml new file mode 100644 index 00000000000..052ef70c41a --- /dev/null +++ b/changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml @@ -0,0 +1,5 @@ +--- +title: Fix bug when links in tabs of the labels index pages ends with .html +merge_request: 22716 +author: +type: fixed diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index a2cda58e5d2..c04f679bcf0 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -211,4 +211,29 @@ describe LabelsHelper do end end end + + describe 'labels_filter_path' do + let(:group) { create(:group) } + let(:project) { create(:project) } + + it 'links to the dashboard labels page' do + expect(labels_filter_path).to eq(dashboard_labels_path) + end + + it 'links to the group labels page' do + assign(:group, group) + + expect(helper.labels_filter_path).to eq(group_labels_path(group)) + end + + it 'links to the project labels page' do + assign(:project, project) + + expect(helper.labels_filter_path).to eq(project_labels_path(project)) + end + + it 'supports json format' do + expect(labels_filter_path(format: :json)).to eq(dashboard_labels_path(format: :json)) + end + end end |