Commit d93d1f9e authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray Committed by Phil Hughes

Check for sidebar cookie instead of class when resizing window

parent ce14fae5
...@@ -68,7 +68,7 @@ export default class NewNavSidebar { ...@@ -68,7 +68,7 @@ export default class NewNavSidebar {
if (breakpoint === 'sm' || breakpoint === 'md') { if (breakpoint === 'sm' || breakpoint === 'md') {
this.toggleCollapsedSidebar(true); this.toggleCollapsedSidebar(true);
} else if (breakpoint === 'lg') { } else if (breakpoint === 'lg') {
const collapse = this.$sidebar.hasClass('sidebar-icons-only'); const collapse = Cookies.get('sidebar_collapsed') === 'true';
this.toggleCollapsedSidebar(collapse); this.toggleCollapsedSidebar(collapse);
} }
} }
......
...@@ -13,7 +13,7 @@ describe 'Issue Boards', js: true do ...@@ -13,7 +13,7 @@ describe 'Issue Boards', js: true do
project.team << [user, :master] project.team << [user, :master]
project.team << [user2, :master] project.team << [user2, :master]
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) page.driver.set_cookie('sidebar_collapsed', 'true')
sign_in(user) sign_in(user)
end end
......
...@@ -28,7 +28,7 @@ describe 'Visual tokens', js: true do ...@@ -28,7 +28,7 @@ describe 'Visual tokens', js: true do
sign_in(user) sign_in(user)
create(:issue, project: project) create(:issue, project: project)
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) page.driver.set_cookie('sidebar_collapsed', 'true')
visit project_issues_path(project) visit project_issues_path(project)
end end
......
...@@ -22,7 +22,7 @@ feature 'Diff note avatars', js: true do ...@@ -22,7 +22,7 @@ feature 'Diff note avatars', js: true do
project.team << [user, :master] project.team << [user, :master]
sign_in user sign_in user
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) page.driver.set_cookie('sidebar_collapsed', 'true')
end end
context 'discussion tab' do context 'discussion tab' do
......
...@@ -6,7 +6,7 @@ feature 'Merge requests > User posts diff notes', :js do ...@@ -6,7 +6,7 @@ feature 'Merge requests > User posts diff notes', :js do
let(:project) { merge_request.source_project } let(:project) { merge_request.source_project }
before do before do
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) page.driver.set_cookie('sidebar_collapsed', 'true')
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
......
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