diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-12 03:12:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-12 03:12:55 +0300 |
commit | 4e65fc3589914bc328539943f1164f4aff2b8d58 (patch) | |
tree | 0bdfcd44063ce9148fc121a2635bc05a6186f0eb /spec/views | |
parent | 9643359dd3a54154ecf0cb8efab39599529aa90c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/merge_requests/edit.html.haml_spec.rb | 76 |
1 files changed, 61 insertions, 15 deletions
diff --git a/spec/views/projects/merge_requests/edit.html.haml_spec.rb b/spec/views/projects/merge_requests/edit.html.haml_spec.rb index 8774623d07e..bb8a4455775 100644 --- a/spec/views/projects/merge_requests/edit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/edit.html.haml_spec.rb @@ -35,30 +35,76 @@ RSpec.describe 'projects/merge_requests/edit.html.haml' do .and_return(User.find(closed_merge_request.author_id)) end - context 'when a merge request without fork' do - it "shows editable fields" do - unlink_project.execute - closed_merge_request.reload - + shared_examples 'merge request shows editable fields' do + it 'shows editable fields' do render expect(rendered).to have_field('merge_request[title]') expect(rendered).to have_selector('input[name="merge_request[description]"]', visible: false) - expect(rendered).to have_selector('input[name="merge_request[label_ids][]"]', visible: false) expect(rendered).to have_selector('.js-milestone-dropdown-root') - expect(rendered).not_to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).to have_selector('#merge_request_target_branch', visible: false) end end - context 'when a merge request with an existing source project is closed' do - it "shows editable fields" do - render + context 'with the visible_label_selection_on_metadata feature flag enabled' do + before do + stub_feature_flags(visible_label_selection_on_metadata: true) + end - expect(rendered).to have_field('merge_request[title]') - expect(rendered).to have_selector('input[name="merge_request[description]"]', visible: false) - expect(rendered).to have_selector('input[name="merge_request[label_ids][]"]', visible: false) - expect(rendered).to have_selector('.js-milestone-dropdown-root') - expect(rendered).to have_selector('#merge_request_target_branch', visible: false) + context 'when a merge request without fork' do + it_behaves_like 'merge request shows editable fields' + + it "shows editable fields" do + unlink_project.execute + closed_merge_request.reload + + render + + expect(rendered).not_to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).to have_selector('.js-issuable-form-label-selector') + end + end + + context 'when a merge request with an existing source project is closed' do + it_behaves_like 'merge request shows editable fields' + + it "shows editable fields" do + render + + expect(rendered).to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).to have_selector('.js-issuable-form-label-selector') + end + end + end + + context 'with the visible_label_selection_on_metadata feature flag disabled' do + before do + stub_feature_flags(visible_label_selection_on_metadata: false) + end + + context 'when a merge request without fork' do + it_behaves_like 'merge request shows editable fields' + + it "shows editable fields" do + unlink_project.execute + closed_merge_request.reload + + render + + expect(rendered).not_to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).not_to have_selector('.js-issuable-form-label-selector') + end + end + + context 'when a merge request with an existing source project is closed' do + it_behaves_like 'merge request shows editable fields' + + it "shows editable fields" do + render + + expect(rendered).to have_selector('#merge_request_target_branch', visible: false) + expect(rendered).not_to have_selector('.js-issuable-form-label-selector') + end end end end |