Commit 1d9957d1 authored by Robert Speicher's avatar Robert Speicher Committed by Lin Jen-Shin

Merge branch 'fix/gb/fix-container-registry-nav-link' into 'master'

Fix container registry navigation menu highlights

Closes #31027

See merge request !10732
parent 6f07b84d
......@@ -11,13 +11,13 @@
Project
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare repositories tags branches releases graphs network)) do
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare projects/repositories tags branches releases graphs network)) do
= link_to project_files_path(@project), title: 'Repository', class: 'shortcuts-tree' do
%span
Repository
- if project_nav_tab? :container_registry
= nav_link(controller: %w(container_registry)) do
= nav_link(controller: %w[projects/registry/repositories]) do
= link_to project_container_registry_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do
%span
Registry
......
require 'spec_helper'
describe 'layouts/nav/_project' do
describe 'container registry tab' do
before do
stub_container_registry_config(enabled: true)
assign(:project, create(:project))
allow(view).to receive(:current_ref).and_return('master')
allow(view).to receive(:can?).and_return(true)
allow(controller).to receive(:controller_name)
.and_return('repositories')
allow(controller).to receive(:controller_path)
.and_return('projects/registry/repositories')
end
it 'has both Registry and Repository tabs' do
render
expect(rendered).to have_text 'Repository'
expect(rendered).to have_text 'Registry'
end
it 'highlights only one tab' do
render
expect(rendered).to have_css('.active', count: 1)
end
it 'highlights container registry tab only' do
render
expect(rendered).to have_css('.active', text: 'Registry')
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