Commit 89b0ba04 authored by Mike Greiling's avatar Mike Greiling

Merge branch...

Merge branch '273313-fy21q4-foundations-kr2-audit-and-update-buttons-on-projects-issuescontroller-new' into 'master'

Audit and update buttons on Projects::IssuesController#new

See merge request gitlab-org/gitlab!57172
parents bf208a35 75a6cbf2
......@@ -47,7 +47,7 @@ export default {
},
deleteIssuableButtonText() {
return sprintf(__('Delete %{issuableType}'), {
issuableType: issuableTypes[this.issuableType],
issuableType: issuableTypes[this.issuableType].toLowerCase(),
});
},
},
......@@ -79,23 +79,23 @@ export default {
:loading="formState.updateLoading"
:disabled="formState.updateLoading || !isSubmitEnabled"
category="primary"
variant="success"
class="float-left qa-save-button"
variant="confirm"
class="float-left qa-save-button gl-mr-3"
type="submit"
@click.prevent="updateIssuable"
>
{{ __('Save changes') }}
</gl-button>
<gl-button class="float-right" @click="closeForm">
<gl-button @click="closeForm">
{{ __('Cancel') }}
</gl-button>
<gl-button
v-if="shouldShowDeleteButton"
:loading="deleteLoading"
:disabled="deleteLoading"
category="primary"
category="secondary"
variant="danger"
class="float-right gl-mr-3 qa-delete-button"
class="float-right qa-delete-button"
@click="deleteIssuable"
>
{{ deleteIssuableButtonText }}
......
......@@ -20,4 +20,4 @@
- if has_submit
.row-content-block.footer-block
= f.submit _("Submit %{humanized_resource_name}") % { humanized_resource_name: humanized_resource_name }, class: 'gl-button btn btn-confirm'
= f.submit _("Create %{humanized_resource_name}") % { humanized_resource_name: humanized_resource_name }, class: 'gl-button btn btn-confirm'
......@@ -62,26 +62,24 @@
- is_footer = !(issuable.is_a?(MergeRequest) && issuable.new_record?)
.row-content-block{ class: (is_footer ? "footer-block" : "middle-block") }
.float-right
- if issuable.new_record?
= link_to _('Cancel'), polymorphic_path([@project, issuable.class]), class: 'gl-button btn btn-cancel'
- else
- if can?(current_user, :"destroy_#{issuable.to_ability_name}", @project)
= link_to 'Delete', polymorphic_path([@project, issuable], params: { destroy_confirm: true }), data: { confirm: "#{issuable.human_class_name} will be removed! Are you sure?" }, method: :delete, class: 'btn btn-danger btn-grouped'
= link_to _('Cancel'), polymorphic_path([@project, issuable]), class: 'gl-button btn btn-grouped btn-default btn-cancel'
%span.gl-mr-3
- if issuable.new_record?
= form.submit "Submit #{issuable.class.model_name.human.downcase}", class: 'gl-button btn btn-confirm', data: { qa_selector: 'issuable_create_button' }
- else
= form.submit 'Save changes', class: 'gl-button btn btn-confirm'
- if !issuable.persisted? && !issuable.project.empty_repo? && (guide_url = issuable.project.present.contribution_guide_path)
.inline.gl-mt-3
.gl-mb-5
Please review the
%strong= link_to('contribution guidelines', guide_url)
for this project.
- if issuable.new_record?
= form.submit "Create #{issuable.class.model_name.human.downcase}", class: 'gl-button btn btn-confirm gl-mr-2', data: { qa_selector: 'issuable_create_button' }
- else
= form.submit 'Save changes', class: 'gl-button btn btn-confirm gl-mr-2'
- if issuable.new_record?
= link_to _('Cancel'), polymorphic_path([@project, issuable.class]), class: 'btn gl-button btn-default'
- else
= link_to _('Cancel'), polymorphic_path([@project, issuable]), class: 'gl-button btn btn-default'
- if can?(current_user, :"destroy_#{issuable.to_ability_name}", @project)
= link_to 'Delete', polymorphic_path([@project, issuable], params: { destroy_confirm: true }), data: { confirm: _('%{issuableType} will be removed! Are you sure?') % { issuableType: issuable.human_class_name } }, method: :delete, class: 'btn gl-button btn-danger btn-danger-secondary gl-float-right'
= render_if_exists 'shared/issuable/remove_approver'
- if issuable.respond_to?(:issue_type)
......
---
title: Update issuable submit content order, button variants, and button alignment
merge_request: 57172
author:
type: other
......@@ -66,27 +66,29 @@ export default {
<div class="border-bottom">
<slot name="rules"></slot>
</div>
<div v-if="settings.canEdit && settings.allowMultiRule" class="border-bottom py-3 px-2">
<div v-if="settings.canEdit && settings.allowMultiRule" class="border-bottom py-3 px-3">
<div class="gl-display-flex">
<gl-button
v-if="targetBranch"
:disabled="isLoading"
data-testid="reset-to-defaults"
@click="resetToProjectDefaults"
>
{{ __('Reset to project defaults') }}
</gl-button>
<gl-button
:class="{ 'gl-ml-3': targetBranch, 'gl-ml-0': !targetBranch }"
:class="{ 'gl-mr-3': targetBranch, 'gl-mr-0': !targetBranch }"
:disabled="isLoading"
category="secondary"
variant="info"
size="small"
data-qa-selector="add_approvers_button"
data-testid="add-approval-rule"
@click="openCreateModal(null)"
>
{{ __('Add approval rule') }}
</gl-button>
<gl-button
v-if="targetBranch"
:disabled="isLoading"
size="small"
data-testid="reset-to-defaults"
@click="resetToProjectDefaults"
>
{{ __('Reset to project defaults') }}
</gl-button>
</div>
</div>
<slot name="footer"></slot>
......
......@@ -32,7 +32,7 @@ RSpec.describe 'Delete Epic', :js do
it 'deletes the issue and redirect to epic list' do
page.accept_alert 'Delete this epic and all descendants?' do
find(:button, text: 'Delete Epic').click
find(:button, text: 'Delete epic').click
end
wait_for_requests
......
......@@ -156,7 +156,7 @@ RSpec.describe 'New/edit issue', :js do
fill_in 'issue_weight', with: '1'
click_button 'Submit issue'
click_button 'Create issue'
page.within '.issuable-sidebar' do
page.within '.assignee' do
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Issues > User uses EE quick actions', :js do
describe 'issue-only commands' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
before do
......
......@@ -57,7 +57,7 @@ RSpec.describe "User creates a merge request", :js do
# end
fill_in("Title", with: title)
click_button("Submit merge request")
click_button("Create merge request")
page.within(".js-issuable-actions") do
click_link("Edit", match: :first)
......
......@@ -24,7 +24,7 @@ RSpec.describe 'User creates a merge request with blocking MRs', :js do
visit(project_new_merge_request_path(project, merge_request: mr_params))
fill_in 'Merge request dependencies', with: other_mr.to_reference(full: true)
click_button('Submit merge request')
click_button 'Create merge request'
expect(page).to have_content('Depends on 1 merge request')
end
......
......@@ -9,5 +9,5 @@ RSpec.describe 'Merge request > User creates MR with multiple assignees' do
stub_licensed_features(multiple_merge_request_assignees: true)
end
it_behaves_like 'multiple assignees merge request', 'creates', 'Submit merge request'
it_behaves_like 'multiple assignees merge request', 'creates', 'Create merge request'
end
......@@ -9,5 +9,5 @@ RSpec.describe 'Merge request > User creates MR with multiple reviewers' do
stub_licensed_features(multiple_merge_request_reviewers: true)
end
it_behaves_like 'multiple reviewers merge request', 'creates', 'Submit merge request'
it_behaves_like 'multiple reviewers merge request', 'creates', 'Create merge request'
end
......@@ -25,7 +25,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js do
context 'saving the MR' do
it 'shows the saved MR' do
fill_in 'merge_request_title', with: 'Test'
click_button 'Submit merge request'
click_button 'Create merge request'
expect(page).to have_button('Close merge request')
end
......
......@@ -66,7 +66,7 @@ RSpec.describe 'Merge request > User sets approval rules', :js do
end
it "persists hidden groups that author has no access to when creating MR" do
click_on("Submit merge request")
click_on("Create merge request")
wait_for_requests
click_on("View eligible approvers")
......
......@@ -109,7 +109,7 @@ RSpec.describe 'Merge request > User sets approvers', :js do
click_button 'Add approval rule'
end
click_on("Submit merge request")
click_on("Create merge request")
wait_for_all_requests
expect(page).to have_content("Requires approval.")
......@@ -134,7 +134,7 @@ RSpec.describe 'Merge request > User sets approvers', :js do
end
click_button 'Update approval rule'
click_on("Submit merge request")
click_on("Create merge request")
wait_for_all_requests
click_on("View eligible approvers") if page.has_button?("View eligible approvers")
wait_for_requests
......
......@@ -7,6 +7,7 @@ RSpec.describe "User creates issue", :js do
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project_empty_repo, :public, namespace: group) }
let_it_be(:epic) { create(:epic, group: group, title: 'Sample epic', author: user) }
let(:issue_title) { '500 error on profile' }
before_all do
......@@ -29,7 +30,7 @@ RSpec.describe "User creates issue", :js do
fill_in("Title", with: issue_title)
fill_in("issue_weight", with: weight)
click_button("Submit issue")
click_button 'Create issue'
page.within(".weight") do
expect(page).to have_content(weight)
......@@ -48,7 +49,7 @@ RSpec.describe "User creates issue", :js do
it 'creates an issue with no epic' do
click_button 'Select epic'
find('.gl-new-dropdown-item', text: 'No Epic').click
click_button('Submit issue')
click_button 'Create issue'
wait_for_all_requests
......@@ -62,7 +63,7 @@ RSpec.describe "User creates issue", :js do
it 'credates an issue with an epic' do
click_button 'Select epic'
find('.gl-new-dropdown-item', text: epic.title).click
click_button('Submit issue')
click_button 'Create issue'
wait_for_all_requests
......
......@@ -3,6 +3,7 @@
RSpec.shared_examples 'status page quick actions' do
describe '/publish' do
let_it_be(:status_page_setting) { create(:status_page_setting, :enabled, project: project) }
let(:user) { project.owner }
before do
......@@ -35,7 +36,7 @@ RSpec.shared_examples 'status page quick actions' do
fill_in('Title', with: 'Title')
fill_in('Description', with: "Published issue \n\n/publish")
click_button('Submit issue')
click_button('Create issue')
wait_for_requests
......
......@@ -8774,6 +8774,9 @@ msgstr ""
msgid "Create %{environment}"
msgstr ""
msgid "Create %{humanized_resource_name}"
msgstr ""
msgid "Create %{type}"
msgstr ""
......@@ -29289,9 +29292,6 @@ msgstr ""
msgid "Submit"
msgstr ""
msgid "Submit %{humanized_resource_name}"
msgstr ""
msgid "Submit a review"
msgstr ""
......
......@@ -27,7 +27,7 @@ RSpec.describe 'Ensure Boards do not show stale data on browser back', :js do
fill_in 'issue_title', with: 'issue should be shown'
click_button 'Submit issue'
click_button 'Create issue'
page.go_back
wait_for_requests
......
......@@ -156,7 +156,7 @@ RSpec.describe 'New/edit issue', :js do
expect(page.all('input[name="issue[label_ids][]"]', visible: false)[1].value).to match(label.id.to_s)
expect(page.all('input[name="issue[label_ids][]"]', visible: false)[2].value).to match(label2.id.to_s)
click_button 'Submit issue'
click_button 'Create issue'
page.within '.issuable-sidebar' do
page.within '.assignee' do
......
......@@ -43,7 +43,7 @@ RSpec.describe 'New issue', :js do
end
it 'rejects issue creation' do
click_button 'Submit issue'
click_button 'Create issue'
expect(page).to have_content('discarded')
expect(page).not_to have_content('potential spam')
......@@ -51,7 +51,7 @@ RSpec.describe 'New issue', :js do
end
it 'creates a spam log record' do
expect { click_button 'Submit issue' }
expect { click_button 'Create issue' }
.to log_spam(title: 'issue title', description: 'issue description', user_id: user.id, noteable_type: 'Issue')
end
end
......@@ -63,14 +63,14 @@ RSpec.describe 'New issue', :js do
end
it 'allows issue creation' do
click_button 'Submit issue'
click_button 'Create issue'
expect(page.find('.issue-details h2.title')).to have_content('issue title')
expect(page.find('.issue-details .description')).to have_content('issue description')
end
it 'creates a spam log record' do
expect { click_button 'Submit issue' }
expect { click_button 'Create issue' }
.to log_spam(title: 'issue title', description: 'issue description', user_id: user.id, noteable_type: 'Issue')
end
end
......@@ -101,14 +101,14 @@ RSpec.describe 'New issue', :js do
fill_in 'issue_title', with: 'issue title'
fill_in 'issue_description', with: 'issue description'
click_button 'Submit issue'
click_button 'Create issue'
# it is impossible to test reCAPTCHA automatically and there is no possibility to fill in recaptcha
# reCAPTCHA verification is skipped in test environment and it always returns true
expect(page).not_to have_content('issue title')
expect(page).to have_css('.recaptcha')
click_button 'Submit issue'
click_button 'Create issue'
expect(page.find('.issue-details h2.title')).to have_content('issue title')
expect(page.find('.issue-details .description')).to have_content('issue description')
......@@ -122,7 +122,7 @@ RSpec.describe 'New issue', :js do
end
it 'creates an issue without a need to solve reCAPTCHA' do
click_button 'Submit issue'
click_button 'Create issue'
expect(page).not_to have_css('.recaptcha')
expect(page.find('.issue-details h2.title')).to have_content('issue title')
......@@ -130,7 +130,7 @@ RSpec.describe 'New issue', :js do
end
it 'creates a spam log record' do
expect { click_button 'Submit issue' }
expect { click_button 'Create issue' }
.to log_spam(title: 'issue title', description: 'issue description', user_id: user.id, noteable_type: 'Issue')
end
end
......@@ -148,7 +148,7 @@ RSpec.describe 'New issue', :js do
end
it 'creates an issue without a need to solve reCaptcha' do
click_button 'Submit issue'
click_button 'Create issue'
expect(page).not_to have_css('.recaptcha')
expect(page.find('.issue-details h2.title')).to have_content('issue title')
......@@ -156,7 +156,7 @@ RSpec.describe 'New issue', :js do
end
it 'creates a spam log record' do
expect { click_button 'Submit issue' }
expect { click_button 'Create issue' }
.to log_spam(title: 'issue title', description: 'issue description', user_id: user.id, noteable_type: 'Issue')
end
end
......@@ -178,7 +178,7 @@ RSpec.describe 'New issue', :js do
fill_in 'issue_title', with: 'issue title'
fill_in 'issue_description', with: 'issue description'
click_button 'Submit issue'
click_button 'Create issue'
expect(page.find('.issue-details h2.title')).to have_content('issue title')
expect(page.find('.issue-details .description')).to have_content('issue description')
......
......@@ -54,7 +54,7 @@ RSpec.describe "User creates issue" do
first('.js-md').click
first('.rspec-issuable-form-description').native.send_keys('Description')
click_button("Submit issue")
click_button("Create issue")
expect(page).to have_content(issue_title)
.and have_content(user.name)
......@@ -112,7 +112,7 @@ RSpec.describe "User creates issue" do
fill_in("Title", with: issue_title)
click_button("Label")
click_link(label_titles.first)
click_button("Submit issue")
click_button("Create issue")
expect(page).to have_content(issue_title)
.and have_content(user.name)
......@@ -135,7 +135,7 @@ RSpec.describe "User creates issue" do
expect(find('#issuable-due-date').value).to eq date.to_s
click_button 'Submit issue'
click_button 'Create issue'
page.within '.issuable-sidebar' do
expect(page).to have_content date.to_s(:medium)
......@@ -259,7 +259,7 @@ RSpec.describe "User creates issue" do
fill_in 'issue_title', with: 'bug 345'
fill_in 'issue_description', with: 'bug description'
click_button 'Submit issue'
click_button 'Create issue'
end
end
end
......
......@@ -28,7 +28,7 @@ RSpec.describe 'create a merge request, allowing commits from members who can me
check 'Allow commits from members who can merge to the target branch'
click_button 'Submit merge request'
click_button 'Create merge request'
wait_for_requests
......
......@@ -31,7 +31,7 @@ RSpec.describe "User creates a merge request", :js do
end
fill_in("Title", with: title)
click_button("Submit merge request")
click_button("Create merge request")
page.within(".merge-request") do
expect(page).to have_content(title)
......@@ -103,7 +103,7 @@ RSpec.describe "User creates a merge request", :js do
end
find('.js-assignee-search').click
click_button("Submit merge request")
click_button("Create merge request")
expect(page).to have_content(title).and have_content("Request to merge #{user.namespace.path}:#{source_branch} into master")
end
......
......@@ -32,7 +32,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do
end
it 'shows widget status after creating new merge request' do
click_button 'Submit merge request'
click_button 'Create merge request'
wait_for_requests
......
......@@ -60,7 +60,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js do
expect(page).to have_content "wm.png"
fill_in "merge_request_title", with: "Orphaned MR test"
click_button "Submit merge request"
click_button "Create merge request"
click_button "Check out branch"
......@@ -200,7 +200,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js do
click_button "Compare branches"
expect(page).to have_button("Submit merge request")
expect(page).to have_button("Create merge request")
end
end
end
......@@ -92,7 +92,7 @@ RSpec.describe 'User squashes a merge request', :js do
before do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: source_branch })
check 'merge_request[squash]'
click_on 'Submit merge request'
click_on 'Create merge request'
wait_for_requests
end
......@@ -121,7 +121,7 @@ RSpec.describe 'User squashes a merge request', :js do
context 'when squash is not enabled on merge request creation', :sidekiq_might_not_need_inline do
before do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: source_branch })
click_on 'Submit merge request'
click_on 'Create merge request'
wait_for_requests
end
......
......@@ -48,7 +48,7 @@ describe('Edit Actions components', () => {
vm.formState.title = '';
Vue.nextTick(() => {
expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled');
expect(vm.$el.querySelector('.btn-confirm').getAttribute('disabled')).toBe('disabled');
done();
});
......@@ -65,16 +65,16 @@ describe('Edit Actions components', () => {
describe('updateIssuable', () => {
it('sends update.issauble event when clicking save button', () => {
vm.$el.querySelector('.btn-success').click();
vm.$el.querySelector('.btn-confirm').click();
expect(eventHub.$emit).toHaveBeenCalledWith('update.issuable');
});
it('disabled button after clicking save button', (done) => {
vm.$el.querySelector('.btn-success').click();
vm.$el.querySelector('.btn-confirm').click();
Vue.nextTick(() => {
expect(vm.$el.querySelector('.btn-success').getAttribute('disabled')).toBe('disabled');
expect(vm.$el.querySelector('.btn-confirm').getAttribute('disabled')).toBe('disabled');
done();
});
......
......@@ -43,7 +43,7 @@ RSpec.shared_examples 'a creatable merge request' do
expect(page.all('input[name="merge_request[label_ids][]"]', visible: false)[1].value).to match(label.id.to_s)
expect(page.all('input[name="merge_request[label_ids][]"]', visible: false)[2].value).to match(label2.id.to_s)
click_button 'Submit merge request'
click_button 'Create merge request'
page.within '.issuable-sidebar' do
page.within '.assignee' do
......
......@@ -14,11 +14,11 @@ RSpec.shared_examples 'creating an issue for a thread' do
end
it 'can create a new issue for the project' do
expect { click_button 'Submit issue' }.to change { project.issues.reload.size }.by(1)
expect { click_button 'Create issue' }.to change { project.issues.reload.size }.by(1)
end
it 'resolves the discussion in the merge request' do
click_button 'Submit issue'
click_button 'Create issue'
discussion.first_note.reload
......@@ -26,7 +26,7 @@ RSpec.shared_examples 'creating an issue for a thread' do
end
it 'shows a flash messaage after resolving a discussion' do
click_button 'Submit issue'
click_button 'Create issue'
page.within '.flash-notice' do
# Only check for the word 'Resolved' since the spec might have resolved
......
......@@ -23,7 +23,7 @@ RSpec.shared_examples 'close quick action' do |issuable_type|
it "creates the #{issuable_type} and interprets close quick action accordingly" do
fill_in "#{issuable_type}_title", with: 'bug 345'
fill_in "#{issuable_type}_description", with: "bug description\n/close"
click_button "Submit #{issuable_type}".humanize
click_button "Create #{issuable_type}".humanize
issuable = project.public_send(issuable_type.to_s.pluralize).first
......
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