Commit 1f3225a5 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'mk-fix-breadcrumb-order-33938' into 'master'

Fix breadcrumb order

Closes #33938

See merge request !12322
parents 788f5415 466adeeb
...@@ -15,7 +15,7 @@ module GroupsHelper ...@@ -15,7 +15,7 @@ module GroupsHelper
@has_group_title = true @has_group_title = true
full_title = '' full_title = ''
group.ancestors.each do |parent| group.ancestors.reverse.each do |parent|
full_title += link_to(simple_sanitize(parent.name), group_path(parent), class: 'group-path hidable') full_title += link_to(simple_sanitize(parent.name), group_path(parent), class: 'group-path hidable')
full_title += '<span class="hidable"> / </span>'.html_safe full_title += '<span class="hidable"> / </span>'.html_safe
end end
......
---
title: Fix reversed breadcrumb order for nested groups
merge_request: 12322
author:
require 'spec_helper' require 'spec_helper'
describe GroupsHelper do describe GroupsHelper do
include ApplicationHelper
describe 'group_icon' do describe 'group_icon' do
avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') avatar_file_path = File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
...@@ -81,4 +83,15 @@ describe GroupsHelper do ...@@ -81,4 +83,15 @@ describe GroupsHelper do
end end
end end
end end
describe 'group_title' do
let(:group) { create(:group) }
let(:nested_group) { create(:group, parent: group) }
let(:deep_nested_group) { create(:group, parent: nested_group) }
let!(:very_deep_nested_group) { create(:group, parent: deep_nested_group) }
it 'outputs the groups in the correct order' do
expect(group_title(very_deep_nested_group)).to match(/>#{group.name}<\/a>.*>#{nested_group.name}<\/a>.*>#{deep_nested_group.name}<\/a>/)
end
end
end end
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