diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-17 18:05:40 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-17 18:05:40 +0000 |
commit | a6a4562872017e2e00d0f8172b0580dd54468e05 (patch) | |
tree | 66e9e4b529af3805365ff52378407813da8244bb | |
parent | 46dc00631aeae34c1964888625c5ccd04da6b4c1 (diff) | |
parent | bbb019094b4b5999f96407b20a3c9da469dcf985 (diff) | |
download | gitlab-ce-a6a4562872017e2e00d0f8172b0580dd54468e05.tar.gz |
Merge branch '20808-merge-request-new-diff-view' into 'master'
Fix merge request new view not changing code view rendering style
Correctly respects the code view changing when creating a merge request.
Closes #20808
See merge request !5768
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 2 | ||||
-rw-r--r-- | spec/features/merge_requests/create_new_mr_spec.rb | 19 |
3 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index 580abe71bcc..bd5ffc9a3e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -99,6 +99,7 @@ v 8.11.0 (unreleased) - Speedup DiffNote#active? on discussions, preloading noteables and avoid touching git repository to return diff_refs when possible - Add commit stats in commit api. !5517 (dixpac) - Add CI configuration button on project page + - Fix merge request new view not changing code view rendering style - Make error pages responsive (Takuya Noguchi) - The performance of the project dropdown used for moving issues has been improved - Fix skip_repo parameter being ignored when destroying a namespace diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index bb793cce223..00a3022cbf7 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -198,6 +198,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def new + apply_diff_view_cookie! + build_merge_request @noteable = @merge_request diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb index 11c9de3c4bf..b63931d9d35 100644 --- a/spec/features/merge_requests/create_new_mr_spec.rb +++ b/spec/features/merge_requests/create_new_mr_spec.rb @@ -8,10 +8,11 @@ feature 'Create New Merge Request', feature: true, js: true do project.team << [user, :master] login_as user - visit namespace_project_merge_requests_path(project.namespace, project) end it 'generates a diff for an orphaned branch' do + visit namespace_project_merge_requests_path(project.namespace, project) + click_link 'New Merge Request' expect(page).to have_content('Source branch') expect(page).to have_content('Target branch') @@ -42,4 +43,20 @@ feature 'Create New Merge Request', feature: true, js: true do expect(page).not_to have_content private_project.to_reference end end + + it 'allows to change the diff view' do + visit new_namespace_project_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'fix' }) + + click_link 'Changes' + + expect(page.find_link('Inline')[:class]).to match(/\bactive\b/) + expect(page.find_link('Side-by-side')[:class]).not_to match(/\bactive\b/) + + click_link 'Side-by-side' + + click_link 'Changes' + + expect(page.find_link('Inline')[:class]).not_to match(/\bactive\b/) + expect(page.find_link('Side-by-side')[:class]).to match(/\bactive\b/) + end end |