Commit c6e90708 authored by Thong Kuah's avatar Thong Kuah

Merge branch '223029-squash-commit-tooltip-mr-form' into 'master'

Add Message for  "Squash commits" option when at disabled state in MR form

Closes #223029

See merge request gitlab-org/gitlab!35111
parents 824ef2e4 260d1e44
......@@ -26,3 +26,6 @@
= label_tag 'merge_request[squash]', class: 'form-check-label' do
Squash commits when merge request is accepted.
= link_to icon('question-circle'), help_page_path('user/project/merge_requests/squash_and_merge'), target: '_blank'
- if project.squash_always?
.gl-text-gray-600
= _('Required in this project.')
......@@ -16,6 +16,40 @@ RSpec.describe 'User edits a merge request', :js do
visit(edit_project_merge_request_path(project, merge_request))
end
describe 'Squash commits' do
it 'displays "Required in this project" for "Required" project setting squash option' do
project.project_setting.update!(squash_option: 'always')
visit(edit_project_merge_request_path(project, merge_request))
expect(page).to have_content('Squash commits when merge request is accepted.')
expect(page).to have_content("Required in this project")
end
it 'does not display message for "Allow" project setting squash option' do
project.project_setting.update!(squash_option: 'default_off')
visit(edit_project_merge_request_path(project, merge_request))
expect(page).to have_content('Squash commits when merge request is accepted.')
expect(page).not_to have_content("Required in this project")
end
it 'does not display message for "Encourage" project setting squash option' do
project.project_setting.update!(squash_option: 'default_on')
visit(edit_project_merge_request_path(project, merge_request))
expect(page).to have_content('Squash commits when merge request is accepted.')
expect(page).not_to have_content("Required in this project")
end
it 'is hidden for "Do not allow" project setting squash option' do
project.project_setting.update!(squash_option: 'never')
visit(edit_project_merge_request_path(project, merge_request))
expect(page).not_to have_content('Squash commits when merge request is accepted.')
expect(page).not_to have_css('#merge_request_squash')
end
end
it 'changes the target branch' do
expect(page).to have_content('From master into feature')
......
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