debian-mirror-gitlab/spec/views/layouts/fullscreen.html.haml_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.2 KiB
Ruby
Raw Normal View History

2022-08-13 15:12:31 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'layouts/fullscreen' do
2022-11-25 23:54:43 +05:30
let_it_be(:template) { 'layouts/fullscreen' }
let_it_be(:top_nav_partial) { 'layouts/header/_default' }
let_it_be(:top_nav_responsive_partial) { 'layouts/nav/_top_nav_responsive' }
2022-08-13 15:12:31 +05:30
let_it_be(:user) { create(:user) }
before do
allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
end
2022-10-11 01:57:18 +05:30
it 'renders a flex container' do
render
expect(rendered).to have_selector(".gl--flex-full.gl-h-full")
expect(rendered).to have_selector(".gl--flex-full.gl-w-full")
end
2022-11-25 23:54:43 +05:30
it 'renders flash container' do
render
expect(view).to render_template("layouts/_flash")
expect(rendered).to have_selector(".flash-container.flash-container-no-margin")
end
it 'renders top nav' do
render
expect(view).to render_template(top_nav_partial)
expect(view).to render_template(top_nav_responsive_partial)
end
2022-08-13 15:12:31 +05:30
it_behaves_like 'a layout which reflects the application theme setting'
2022-10-11 01:57:18 +05:30
describe 'sidebar' do
context 'when nav is set' do
before do
allow(view).to receive(:nav).and_return("admin")
render
end
it 'renders the sidebar' do
expect(rendered).to render_template("layouts/nav/sidebar/_admin")
expect(rendered).to have_selector("aside.nav-sidebar")
end
it 'adds the proper classes' do
expect(rendered).to have_selector(".layout-page.gl-mt-0\\!")
end
end
describe 'when nav is not set' do
before do
allow(view).to receive(:nav).and_return(nil)
render
end
it 'does not render the sidebar' do
expect(rendered).not_to render_template("layouts/nav/sidebar/_admin")
expect(rendered).not_to have_selector("aside.nav-sidebar")
end
it 'not add classes' do
expect(rendered).not_to have_selector(".layout-page.gl-mt-0\\!")
end
end
end
2022-11-25 23:54:43 +05:30
context 'when minimal is set' do
subject { render(template: template, formats: :html, locals: { minimal: true }) }
it 'does not render top nav' do
subject
expect(view).not_to render_template(top_nav_partial)
expect(view).not_to render_template(top_nav_responsive_partial)
end
end
2022-08-13 15:12:31 +05:30
end