Commit 0505fc33 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch 'cngo-add-checkbox-labels-to-bulk-edit' into 'master'

Add checkbox labels to bulk edit UI

See merge request gitlab-org/gitlab!61598
parents 4c5f70fa 9757bab0
...@@ -169,7 +169,9 @@ export default { ...@@ -169,7 +169,9 @@ export default {
:checked="checked" :checked="checked"
:data-id="issuable.id" :data-id="issuable.id"
@input="$emit('checked-input', $event)" @input="$emit('checked-input', $event)"
/> >
<span class="gl-sr-only">{{ issuable.title }}</span>
</gl-form-checkbox>
</div> </div>
<div class="issuable-main-info"> <div class="issuable-main-info">
<div data-testid="issuable-title" class="issue-title title"> <div data-testid="issuable-title" class="issue-title title">
......
...@@ -324,7 +324,9 @@ export default { ...@@ -324,7 +324,9 @@ export default {
class="gl-align-self-center" class="gl-align-self-center"
:checked="checkboxChecked" :checked="checkboxChecked"
@input="$emit('checked-input', $event)" @input="$emit('checked-input', $event)"
/> >
<span class="gl-sr-only">{{ __('Select all') }}</span>
</gl-form-checkbox>
<gl-filtered-search <gl-filtered-search
ref="filteredSearchInput" ref="filteredSearchInput"
v-model="filterValue" v-model="filterValue"
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
.issuable-info-container .issuable-info-container
- if @can_bulk_update - if @can_bulk_update
.issue-check.hidden .issue-check.hidden
= check_box_tag dom_id(issue, "selected"), nil, false, 'data-id' => issue.id, class: "selected-issuable" - checkbox_id = dom_id(issue, "selected")
%label.gl-sr-only{ for: checkbox_id }= issue.title
= check_box_tag checkbox_id, nil, false, 'data-id' => issue.id, class: "selected-issuable"
.issuable-main-info .issuable-main-info
.issue-title.title .issue-title.title
%span.issue-title-text.js-onboarding-issue-item{ dir: "auto" } %span.issue-title-text.js-onboarding-issue-item{ dir: "auto" }
......
%li{ id: dom_id(merge_request), class: mr_css_classes(merge_request), data: { labels: merge_request.label_ids, id: merge_request.id } } %li{ id: dom_id(merge_request), class: mr_css_classes(merge_request), data: { labels: merge_request.label_ids, id: merge_request.id } }
- if @can_bulk_update - if @can_bulk_update
.issue-check.hidden .issue-check.hidden
= check_box_tag dom_id(merge_request, "selected"), nil, false, 'data-id' => merge_request.id, class: "selected-issuable" - checkbox_id = dom_id(merge_request, "selected")
%label.gl-sr-only{ for: checkbox_id }= merge_request.title
= check_box_tag checkbox_id, nil, false, 'data-id' => merge_request.id, class: "selected-issuable"
.issuable-info-container .issuable-info-container
.issuable-main-info .issuable-main-info
......
...@@ -20,7 +20,9 @@ ...@@ -20,7 +20,9 @@
= hidden_field_tag :search, params[:search] = hidden_field_tag :search, params[:search]
- if @can_bulk_update - if @can_bulk_update
.check-all-holder.d-none.d-sm-block.hidden .check-all-holder.d-none.d-sm-block.hidden
= check_box_tag "check-all-issues", nil, false, class: "check-all-issues left" - checkbox_id = 'check-all-issues'
%label.gl-sr-only{ for: checkbox_id }= _('Select all')
= check_box_tag checkbox_id, nil, false, class: "check-all-issues left"
- if Feature.enabled?(:boards_filtered_search, @group) && is_epic_board - if Feature.enabled?(:boards_filtered_search, @group) && is_epic_board
#js-board-filtered-search{ data: { full_path: @group&.full_path } } #js-board-filtered-search{ data: { full_path: @group&.full_path } }
- else - else
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
.issuable-info-container .issuable-info-container
- if @can_bulk_update - if @can_bulk_update
.issue-check.hidden .issue-check.hidden
= check_box_tag dom_id(epic, "selected"), nil, false, 'data-id' => epic.id, class: "selected-issuable" - checkbox_id = dom_id(epic, "selected")
%label.gl-sr-only{ for: checkbox_id }= epic.title
= check_box_tag checkbox_id, nil, false, 'data-id' => epic.id, class: "selected-issuable"
.issuable-main-info .issuable-main-info
.issue-title.title .issue-title.title
%span.issue-title-text{ data: { qa_selector: 'epic_title_text' } } %span.issue-title-text{ data: { qa_selector: 'epic_title_text' } }
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
= hidden_field_tag :search, params[:search] = hidden_field_tag :search, params[:search]
- if @can_bulk_update - if @can_bulk_update
.check-all-holder.d-none.d-sm-block.hidden .check-all-holder.d-none.d-sm-block.hidden
= check_box_tag "check-all-issues", nil, false, class: "check-all-issues left" - checkbox_id = 'check-all-issues'
%label.gl-sr-only{ for: checkbox_id }= _('Select all')
= check_box_tag checkbox_id, nil, false, class: "check-all-issues left"
.epics-other-filters.filtered-search-wrapper.d-flex.flex-column.flex-md-row .epics-other-filters.filtered-search-wrapper.d-flex.flex-column.flex-md-row
.filtered-search-box .filtered-search-box
= dropdown_tag(_('Recent searches'), = dropdown_tag(_('Recent searches'),
......
...@@ -17,11 +17,11 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -17,11 +17,11 @@ RSpec.describe 'Issues > Bulk edit issues' do
shared_examples 'bulk edit option in sidebar' do |context| shared_examples 'bulk edit option in sidebar' do |context|
it 'is present when bulk edit is enabled' do it 'is present when bulk edit is enabled' do
enable_bulk_update(context) enable_bulk_update(context)
expect(page).to have_css('.issuable-sidebar') expect(page).to have_css('aside[aria-label="Bulk update"]')
end end
it 'is not present when bulk edit is disabled' do it 'is not present when bulk edit is disabled' do
expect(page).not_to have_css('.issuable-sidebar') expect(page).not_to have_css('aside[aria-label="Bulk update"]')
end end
end end
...@@ -33,8 +33,10 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -33,8 +33,10 @@ RSpec.describe 'Issues > Bulk edit issues' do
context 'epic', :js do context 'epic', :js do
context 'to all issues' do context 'to all issues' do
before do before do
check 'check-all-issues' check 'Select all'
open_epic_dropdown [epic.title] click_button 'Select epic'
wait_for_requests
click_button epic.title
update_issues update_issues
end end
...@@ -46,8 +48,10 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -46,8 +48,10 @@ RSpec.describe 'Issues > Bulk edit issues' do
context 'to a issue' do context 'to a issue' do
before do before do
check "selected_issue_#{issue1.id}" check issue1.title
open_epic_dropdown [epic.title] click_button 'Select epic'
wait_for_requests
click_button epic.title
update_issues update_issues
end end
...@@ -67,8 +71,9 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -67,8 +71,9 @@ RSpec.describe 'Issues > Bulk edit issues' do
context 'health_status', :js do context 'health_status', :js do
context 'to all issues' do context 'to all issues' do
before do before do
check 'check-all-issues' check 'Select all'
open_health_status_dropdown ['On track'] click_button 'Select health status'
click_button 'On track'
update_issues update_issues
end end
...@@ -80,8 +85,9 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -80,8 +85,9 @@ RSpec.describe 'Issues > Bulk edit issues' do
context 'to an issue' do context 'to an issue' do
before do before do
check "selected_issue_#{issue1.id}" check issue1.title
open_health_status_dropdown ['At risk'] click_button 'Select health status'
click_button 'At risk'
update_issues update_issues
end end
...@@ -100,8 +106,10 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -100,8 +106,10 @@ RSpec.describe 'Issues > Bulk edit issues' do
end end
context 'to all issues' do context 'to all issues' do
before do before do
check 'check-all-issues' check 'Select all'
open_iteration_dropdown ['Iteration 1'] click_button 'Select iteration'
wait_for_requests
click_button 'Iteration 1'
update_issues update_issues
end end
...@@ -142,8 +150,8 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -142,8 +150,8 @@ RSpec.describe 'Issues > Bulk edit issues' do
shared_examples 'bulk edit health_status with insufficient permissions' do shared_examples 'bulk edit health_status with insufficient permissions' do
it 'cannot bulk assign health_status', :aggregate_failures do it 'cannot bulk assign health_status', :aggregate_failures do
expect(page).not_to have_button 'Edit issues' expect(page).not_to have_button 'Edit issues'
expect(page).not_to have_css '.check-all-issues' expect(page).not_to have_unchecked_field 'Select all'
expect(page).not_to have_css '.issue-check' expect(page).not_to have_unchecked_field issue1.title
end end
end end
...@@ -200,33 +208,6 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -200,33 +208,6 @@ RSpec.describe 'Issues > Bulk edit issues' do
end end
end end
def open_epic_dropdown(items = [])
page.within('.issues-bulk-update') do
click_button 'Select epic'
items.map do |item|
find('.gl-new-dropdown-item', text: item).click
end
end
end
def open_health_status_dropdown(items = [])
page.within('.issues-bulk-update') do
click_button 'Select health status'
items.map do |item|
find('[data-testid="health-status-dropdown-item"]', text: item).click
end
end
end
def open_iteration_dropdown(items = [])
page.within('.issues-bulk-update') do
click_button 'Select iteration'
items.map do |item|
find('.dropdown-item', text: item).click
end
end
end
def update_issues def update_issues
click_button 'Update all' click_button 'Update all'
wait_for_requests wait_for_requests
...@@ -241,6 +222,8 @@ RSpec.describe 'Issues > Bulk edit issues' do ...@@ -241,6 +222,8 @@ RSpec.describe 'Issues > Bulk edit issues' do
visit issues_group_path(group) visit issues_group_path(group)
end end
wait_for_requests
click_button 'Edit issues' click_button 'Edit issues'
end end
end end
...@@ -20,17 +20,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -20,17 +20,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end end
context 'sidebar' do context 'sidebar' do
before do
enable_bulk_update
end
it 'is present when bulk edit is enabled' do it 'is present when bulk edit is enabled' do
expect(page).to have_css('.issuable-sidebar') enable_bulk_update
expect(page).to have_css 'aside[aria-label="Bulk update"]'
end end
it 'is not present when bulk edit is disabled' do it 'is not present when bulk edit is disabled' do
disable_bulk_update expect(page).not_to have_css 'aside[aria-label="Bulk update"]'
expect(page).not_to have_css('.issuable-sidebar')
end end
end end
...@@ -42,7 +38,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -42,7 +38,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'a label' do context 'a label' do
context 'to all issues' do context 'to all issues' do
before do before do
check 'check-all-issues' check 'Select all'
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
update_issues update_issues
end end
...@@ -57,8 +53,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -57,8 +53,8 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to some issues' do context 'to some issues' do
before do before do
check "selected_issue_#{issue1.id}" check issue1.title
check "selected_issue_#{issue2.id}" check issue2.title
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
update_issues update_issues
end end
...@@ -73,7 +69,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -73,7 +69,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to an issue' do context 'to an issue' do
before do before do
check "selected_issue_#{issue1.id}" check issue1.title
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
update_issues update_issues
end end
...@@ -89,7 +85,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -89,7 +85,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to an issue by selecting the label first' do context 'to an issue by selecting the label first' do
before do before do
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
check "selected_issue_#{issue1.id}" check issue1.title
update_issues update_issues
end end
...@@ -105,7 +101,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -105,7 +101,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'multiple labels' do context 'multiple labels' do
context 'to all issues' do context 'to all issues' do
before do before do
check 'check-all-issues' check 'Select all'
open_labels_dropdown %w(bug feature) open_labels_dropdown %w(bug feature)
update_issues update_issues
end end
...@@ -120,7 +116,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -120,7 +116,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'to a issue' do context 'to a issue' do
before do before do
check "selected_issue_#{issue1.id}" check issue1.title
open_labels_dropdown %w(bug feature) open_labels_dropdown %w(bug feature)
update_issues update_issues
end end
...@@ -141,7 +137,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -141,7 +137,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
issue2.labels << feature issue2.labels << feature
enable_bulk_update enable_bulk_update
check 'check-all-issues' check 'Select all'
open_labels_dropdown ['bug'] open_labels_dropdown ['bug']
update_issues update_issues
...@@ -162,7 +158,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -162,7 +158,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
issue2.labels << feature issue2.labels << feature
enable_bulk_update enable_bulk_update
check 'check-all-issues' check 'Select all'
unmark_labels_in_dropdown %w(bug feature) unmark_labels_in_dropdown %w(bug feature)
update_issues update_issues
end end
...@@ -229,7 +225,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -229,7 +225,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug' expect(find("#issue_#{issue1.id}")).to have_content 'bug'
expect(find("#issue_#{issue2.id}")).to have_content 'feature' expect(find("#issue_#{issue2.id}")).to have_content 'feature'
check 'check-all-issues' check 'Select all'
open_milestone_dropdown(['First Release']) open_milestone_dropdown(['First Release'])
update_issues update_issues
...@@ -250,7 +246,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -250,7 +246,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
it 'keeps existing label and new label is present' do it 'keeps existing label and new label is present' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug' expect(find("#issue_#{issue1.id}")).to have_content 'bug'
check 'check-all-issues' check 'Select all'
open_milestone_dropdown ['First Release'] open_milestone_dropdown ['First Release']
open_labels_dropdown ['feature'] open_labels_dropdown ['feature']
update_issues update_issues
...@@ -277,7 +273,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -277,7 +273,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue1.id}")).to have_content 'bug' expect(find("#issue_#{issue1.id}")).to have_content 'bug'
expect(find("#issue_#{issue2.id}")).to have_content 'feature' expect(find("#issue_#{issue2.id}")).to have_content 'feature'
check 'check-all-issues' check 'Select all'
open_milestone_dropdown ['First Release'] open_milestone_dropdown ['First Release']
unmark_labels_in_dropdown ['feature'] unmark_labels_in_dropdown ['feature']
...@@ -309,7 +305,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -309,7 +305,7 @@ RSpec.describe 'Issues > Labels bulk assignment' do
expect(find("#issue_#{issue2.id}")).to have_content 'feature' expect(find("#issue_#{issue2.id}")).to have_content 'feature'
expect(find("#issue_#{issue2.id}")).to have_content 'First Release' expect(find("#issue_#{issue2.id}")).to have_content 'First Release'
check 'check-all-issues' check 'Select all'
open_milestone_dropdown(['No milestone']) open_milestone_dropdown(['No milestone'])
update_issues update_issues
...@@ -369,31 +365,31 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -369,31 +365,31 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end end
it 'applies label from filtered results' do it 'applies label from filtered results' do
check 'check-all-issues' check 'Select all'
page.within('.issues-bulk-update') do within('aside[aria-label="Bulk update"]') do
click_button 'Select labels' click_button 'Select labels'
wait_for_requests wait_for_requests
expect(find('.dropdown-menu-labels li', text: 'bug')).to have_css('.is-active') expect(page).to have_link 'bug', class: 'is-active'
expect(find('.dropdown-menu-labels li', text: 'feature')).to have_css('.is-indeterminate') expect(page).to have_link 'feature', class: 'is-indeterminate'
click_link 'bug' click_link 'bug'
find('.dropdown-input-field', visible: true).set('wontfix') fill_in 'Search', with: 'wontfix'
click_link 'wontfix' click_link 'wontfix'
end end
update_issues update_issues
page.within '.issues-holder' do first_issue = find("#issue_#{issue1.id}")
expect(find("#issue_#{issue1.id}")).not_to have_content 'bug' expect(first_issue).not_to have_content 'bug'
expect(find("#issue_#{issue1.id}")).to have_content 'feature' expect(first_issue).to have_content 'feature'
expect(find("#issue_#{issue1.id}")).to have_content 'wontfix' expect(first_issue).to have_content 'wontfix'
expect(find("#issue_#{issue2.id}")).not_to have_content 'bug' second_issue = find("#issue_#{issue2.id}")
expect(find("#issue_#{issue2.id}")).not_to have_content 'feature' expect(second_issue).not_to have_content 'bug'
expect(find("#issue_#{issue2.id}")).to have_content 'wontfix' expect(second_issue).not_to have_content 'feature'
end expect(second_issue).to have_content 'wontfix'
end end
end end
end end
...@@ -408,24 +404,22 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -408,24 +404,22 @@ RSpec.describe 'Issues > Labels bulk assignment' do
context 'cannot bulk assign labels' do context 'cannot bulk assign labels' do
it do it do
expect(page).not_to have_button 'Edit issues' expect(page).not_to have_button 'Edit issues'
expect(page).not_to have_css '.check-all-issues' expect(page).not_to have_unchecked_field 'Select all'
expect(page).not_to have_css '.issue-check' expect(page).not_to have_unchecked_field issue1.title
end end
end end
end end
def open_milestone_dropdown(items = []) def open_milestone_dropdown(items = [])
page.within('.issues-bulk-update') do click_button 'Select milestone'
click_button 'Select milestone' wait_for_requests
wait_for_requests items.map do |item|
items.map do |item| click_link item
click_link item
end
end end
end end
def open_labels_dropdown(items = [], unmark = false) def open_labels_dropdown(items = [], unmark = false)
page.within('.issues-bulk-update') do within('aside[aria-label="Bulk update"]') do
click_button 'Select labels' click_button 'Select labels'
wait_for_requests wait_for_requests
items.map do |item| items.map do |item|
...@@ -446,12 +440,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -446,12 +440,10 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end end
def check_issue(issue, uncheck = false) def check_issue(issue, uncheck = false)
page.within('.issues-list') do if uncheck
if uncheck uncheck issue.title
uncheck "selected_issue_#{issue.id}" else
else check issue.title
check "selected_issue_#{issue.id}"
end
end end
end end
...@@ -460,12 +452,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do ...@@ -460,12 +452,13 @@ RSpec.describe 'Issues > Labels bulk assignment' do
end end
def update_issues def update_issues
find('.update-selected-issues').click click_button 'Update all'
wait_for_requests wait_for_requests
end end
def enable_bulk_update def enable_bulk_update
visit project_issues_path(project) visit project_issues_path(project)
wait_for_requests
click_button 'Edit issues' click_button 'Edit issues'
end end
......
...@@ -17,10 +17,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -17,10 +17,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project) visit project_issues_path(project)
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
find('.js-issue-status').click click_button 'Select status'
click_link 'Closed'
find('.dropdown-menu-status a', text: 'Closed').click
click_update_issues_button click_update_issues_button
expect(page).to have_selector('.issue', count: 0) expect(page).to have_selector('.issue', count: 0)
end end
...@@ -30,10 +30,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -30,10 +30,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project, state: 'closed') visit project_issues_path(project, state: 'closed')
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
find('.js-issue-status').click click_button 'Select status'
click_link 'Open'
find('.dropdown-menu-status a', text: 'Open').click
click_update_issues_button click_update_issues_button
expect(page).to have_selector('.issue', count: 0) expect(page).to have_selector('.issue', count: 0)
end end
...@@ -44,10 +44,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -44,10 +44,10 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project) visit project_issues_path(project)
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
click_update_assignee_button click_update_assignee_button
click_link user.username
find('.dropdown-menu-user-link', text: user.username).click
click_update_issues_button click_update_issues_button
page.within('.issue .controls') do page.within('.issue .controls') do
...@@ -59,13 +59,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -59,13 +59,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
create_assigned create_assigned
visit project_issues_path(project) visit project_issues_path(project)
expect(find('.issue:first-of-type')).to have_link "Assigned to #{user.name}"
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
click_update_assignee_button click_update_assignee_button
click_link 'Unassigned' click_link 'Unassigned'
click_update_issues_button click_update_issues_button
expect(find('.issue:first-child .controls')).not_to have_css('.author-link')
expect(find('.issue:first-of-type')).not_to have_link "Assigned to #{user.name}"
end end
end end
...@@ -76,10 +78,9 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -76,10 +78,9 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
visit project_issues_path(project) visit project_issues_path(project)
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
find('.issues-bulk-update .js-milestone-select').click click_button 'Select milestone'
click_link milestone.title
find('.dropdown-menu-milestone a', text: milestone.title).click
click_update_issues_button click_update_issues_button
expect(page.find('.issue')).to have_content milestone.title expect(page.find('.issue')).to have_content milestone.title
...@@ -91,16 +92,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -91,16 +92,15 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
wait_for_requests wait_for_requests
expect(first('.issue')).to have_content milestone.title expect(find('.issue:first-of-type')).to have_text milestone.title
click_button 'Edit issues' click_button 'Edit issues'
find('#check-all-issues').click check 'Select all'
find('.issues-bulk-update .js-milestone-select').click click_button 'Select milestone'
click_link 'No milestone'
find('.dropdown-menu-milestone a', text: "No milestone").click
click_update_issues_button click_update_issues_button
expect(find('.issue:first-child')).not_to have_content milestone.title expect(find('.issue:first-of-type')).not_to have_text milestone.title
end end
end end
...@@ -117,12 +117,12 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do ...@@ -117,12 +117,12 @@ RSpec.describe 'Multiple issue updating from issues#index', :js do
end end
def click_update_assignee_button def click_update_assignee_button
find('.js-update-assignee').click click_button 'Select assignee'
wait_for_requests wait_for_requests
end end
def click_update_issues_button def click_update_issues_button
find('.update-selected-issues').click click_button 'Update all'
wait_for_requests wait_for_requests
end end
end end
...@@ -44,7 +44,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do ...@@ -44,7 +44,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do
click_button 'Edit merge requests' click_button 'Edit merge requests'
expect(page).not_to have_css('.js-issue-status') expect(page).not_to have_button 'Select status'
end end
end end
...@@ -57,9 +57,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do ...@@ -57,9 +57,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do
it 'updates merge request with assignee' do it 'updates merge request with assignee' do
change_assignee(user.name) change_assignee(user.name)
page.within('.merge-request .controls') do expect(find('.merge-request')).to have_link "Assigned to #{user.name}"
expect(find('.author-link')["title"]).to have_content(user.name)
end
end end
end end
...@@ -72,7 +70,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do ...@@ -72,7 +70,7 @@ RSpec.describe 'Merge requests > User mass updates', :js do
it 'removes assignee from the merge request' do it 'removes assignee from the merge request' do
change_assignee('Unassigned') change_assignee('Unassigned')
expect(find('.merge-request .controls')).not_to have_css('.author-link') expect(find('.merge-request')).not_to have_link "Assigned to #{user.name}"
end end
end end
end end
...@@ -109,35 +107,33 @@ RSpec.describe 'Merge requests > User mass updates', :js do ...@@ -109,35 +107,33 @@ RSpec.describe 'Merge requests > User mass updates', :js do
def change_status(text) def change_status(text)
click_button 'Edit merge requests' click_button 'Edit merge requests'
find('#check-all-issues').click check 'Select all'
find('.js-issue-status').click click_button 'Select status'
find('.dropdown-menu-status a', text: text).click click_link text
click_update_merge_requests_button click_update_merge_requests_button
end end
def change_assignee(text) def change_assignee(text)
click_button 'Edit merge requests' click_button 'Edit merge requests'
find('#check-all-issues').click check 'Select all'
find('.js-update-assignee').click within 'aside[aria-label="Bulk update"]' do
wait_for_requests click_button 'Select assignee'
wait_for_requests
page.within '.dropdown-menu-user' do
click_link text click_link text
end end
click_update_merge_requests_button click_update_merge_requests_button
end end
def change_milestone(text) def change_milestone(text)
click_button 'Edit merge requests' click_button 'Edit merge requests'
find('#check-all-issues').click check 'Select all'
find('.issues-bulk-update .js-milestone-select').click click_button 'Select milestone'
find('.dropdown-menu-milestone a', text: text).click click_link text
click_update_merge_requests_button click_update_merge_requests_button
end end
def click_update_merge_requests_button def click_update_merge_requests_button
find('.update-selected-issues').click click_button 'Update all'
wait_for_requests wait_for_requests
end end
end end
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