From 2f40aa68d92f3f51167aaccc9fab2801ee185605 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 24 Jan 2019 14:48:03 +0000 Subject: Added dropdown for diff settings Dropdown includes buttons for tree view rendering mode and buttons for the compare view (inline or side-by-side) Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55491 --- spec/features/merge_request/user_comments_on_diff_spec.rb | 1 + .../user_resolves_diff_notes_and_discussions_resolve_spec.rb | 1 + .../merge_request/user_toggles_whitespace_changes_spec.rb | 12 +++++++++--- spec/features/merge_request/user_views_diffs_spec.rb | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'spec/features/merge_request') diff --git a/spec/features/merge_request/user_comments_on_diff_spec.rb b/spec/features/merge_request/user_comments_on_diff_spec.rb index 00cf368e8c9..eb4b2cf5bd0 100644 --- a/spec/features/merge_request/user_comments_on_diff_spec.rb +++ b/spec/features/merge_request/user_comments_on_diff_spec.rb @@ -91,6 +91,7 @@ describe 'User comments on a diff', :js do # Check the same comments in the side-by-side view. execute_script("window.scrollTo(0,0);") + find('.js-show-diff-settings').click click_button 'Side-by-side' wait_for_requests diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index ba4806821f9..08fa4a98feb 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -126,6 +126,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do describe 'side-by-side view' do before do page.within('.merge-request-tabs') { click_link 'Changes' } + find('.js-show-diff-settings').click page.find('#parallel-diff-btn').click end diff --git a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb index dd860382daa..0decdfe3a14 100644 --- a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb +++ b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb @@ -9,17 +9,23 @@ describe 'Merge request > User toggles whitespace changes', :js do project.add_maintainer(user) sign_in(user) visit diffs_project_merge_request_path(project, merge_request) + + find('.js-show-diff-settings').click end it 'has a button to toggle whitespace changes' do - expect(page).to have_content 'Hide whitespace changes' + expect(page).to have_content 'Show whitespace changes' end describe 'clicking "Hide whitespace changes" button' do it 'toggles the "Hide whitespace changes" button' do - click_link 'Hide whitespace changes' + find('#show-whitespace').click + + visit diffs_project_merge_request_path(project, merge_request) + + find('.js-show-diff-settings').click - expect(page).to have_content 'Show whitespace changes' + expect(find('#show-whitespace')).to be_checked end end end diff --git a/spec/features/merge_request/user_views_diffs_spec.rb b/spec/features/merge_request/user_views_diffs_spec.rb index 7f95a1282f9..0434db04113 100644 --- a/spec/features/merge_request/user_views_diffs_spec.rb +++ b/spec/features/merge_request/user_views_diffs_spec.rb @@ -23,6 +23,8 @@ describe 'User views diffs', :js do end it 'shows diffs' do + find('.js-show-diff-settings').click + expect(page).to have_css('.tab-content #diffs.active') expect(page).to have_css('#parallel-diff-btn', count: 1) expect(page).to have_css('#inline-diff-btn', count: 1) @@ -38,6 +40,8 @@ describe 'User views diffs', :js do context 'when in the side-by-side view' do before do + find('.js-show-diff-settings').click + click_button 'Side-by-side' wait_for_requests -- cgit v1.2.1