summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-01-27 23:09:00 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2017-01-27 23:09:00 +0000
commit39a33eecd4bb4fed880850fe867b8434272e5346 (patch)
tree469d2ad1ee3cc7c0b843de18df3bff7b16690884 /spec
parentd2a2ba9381b3f3e11760434a2f963090ae071284 (diff)
parent1da62670656ea9f606cf27796fce76ed8291dff8 (diff)
downloadgitlab-ce-39a33eecd4bb4fed880850fe867b8434272e5346.tar.gz
Merge branch 'issuable-sidebar-bug' into 'master'
Fixed Issuable sidebar so it remains closed on mobile/smaller screen devices See merge request !7466
Diffstat (limited to 'spec')
-rw-r--r--spec/features/issues/issue_sidebar_spec.rb25
-rw-r--r--spec/support/mobile_helpers.rb13
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb
index bc068b5e7e0..1eb981942ea 100644
--- a/spec/features/issues/issue_sidebar_spec.rb
+++ b/spec/features/issues/issue_sidebar_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
feature 'Issue Sidebar', feature: true do
include WaitForAjax
+ include MobileHelpers
let(:project) { create(:project, :public) }
let(:issue) { create(:issue, project: project) }
@@ -59,6 +60,23 @@ feature 'Issue Sidebar', feature: true do
end
end
+ context 'sidebar', js: true do
+ it 'changes size when the screen size is smaller' do
+ sidebar_selector = 'aside.right-sidebar.right-sidebar-collapsed'
+ # Resize the window
+ resize_screen_sm
+ # Make sure the sidebar is collapsed
+ expect(page).to have_css(sidebar_selector)
+ # Once is collapsed let's open the sidebard and reload
+ open_issue_sidebar
+ refresh
+ expect(page).to have_css(sidebar_selector)
+ # Restore the window size as it was including the sidebar
+ restore_window_size
+ open_issue_sidebar
+ end
+ end
+
context 'creating a new label', js: true do
it 'shows option to crate a new label is present' do
page.within('.block.labels') do
@@ -109,4 +127,11 @@ feature 'Issue Sidebar', feature: true do
def visit_issue(project, issue)
visit namespace_project_issue_path(project.namespace, project, issue)
end
+
+ def open_issue_sidebar
+ page.within('aside.right-sidebar.right-sidebar-collapsed') do
+ find('.js-sidebar-toggle').click
+ sleep 1
+ end
+ end
end
diff --git a/spec/support/mobile_helpers.rb b/spec/support/mobile_helpers.rb
new file mode 100644
index 00000000000..20d5849bcab
--- /dev/null
+++ b/spec/support/mobile_helpers.rb
@@ -0,0 +1,13 @@
+module MobileHelpers
+ def resize_screen_sm
+ resize_window(900, 768)
+ end
+
+ def restore_window_size
+ resize_window(1366, 768)
+ end
+
+ def resize_window(width, height)
+ page.driver.resize_window width, height
+ end
+end