Commit 6b396640 authored by Luke Bennett's avatar Luke Bennett Committed by Ezekiel Kigbo

Add tests for nav sidebar collapsed on render

Adds rspec view tests that expect the nav sidebar
to have a class that will cause the nav sidebar
to be rendered collapsed with or without js.

Tests the nav sidebar on the admin, group,
instance statistics, user profile and project
sidebars.
parent fde3f619
# frozen_string_literal: true
shared_examples 'has nav sidebar' do
it 'has collapsed nav sidebar on mobile' do
render
expect(rendered).to have_selector('.nav-sidebar.sidebar-collapsed-mobile')
end
end
...@@ -26,6 +26,8 @@ describe 'layouts/nav/sidebar/_admin' do ...@@ -26,6 +26,8 @@ describe 'layouts/nav/sidebar/_admin' do
it_behaves_like 'page has active tab', 'Overview' it_behaves_like 'page has active tab', 'Overview'
end end
it_behaves_like 'has nav sidebar'
context 'on projects' do context 'on projects' do
before do before do
allow(controller).to receive(:controller_name).and_return('projects') allow(controller).to receive(:controller_name).and_return('projects')
......
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/nav/sidebar/_group' do
let(:group) { create(:group) }
before do
assign(:group, group)
end
it_behaves_like 'has nav sidebar'
end
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/nav/sidebar/_instance_statistics' do
it_behaves_like 'has nav sidebar'
end
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/nav/sidebar/_profile' do
let(:user) { create(:user) }
before do
allow(view).to receive(:current_user).and_return(user)
end
it_behaves_like 'has nav sidebar'
end
...@@ -11,6 +11,8 @@ describe 'layouts/nav/sidebar/_project' do ...@@ -11,6 +11,8 @@ describe 'layouts/nav/sidebar/_project' do
allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can?).and_return(true)
end end
it_behaves_like 'has nav sidebar'
describe 'issue boards' do describe 'issue boards' do
it 'has board tab' do it 'has board tab' do
render render
......
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