Commit 6e5a7a2a authored by Clement Ho's avatar Clement Ho

[skip ci] Fix rspec for form_spec

parent 321dcc2a
......@@ -17,7 +17,7 @@
- issuable.assignees.each do |assignee|
= hidden_field_tag "#{issuable.to_ability_name}[assignee_ids][]", assignee.id, id: nil, data: { meta: assignee.name }
- options = { toggle_class: "js-user-search js-author-search", title: 'Select assignee', filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author",
- options = { toggle_class: "js-user-search js-assignee-search", title: 'Select assignee', filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee",
placeholder: "Search users", data: { first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: issuable.project.try(:id), field_name: "#{issuable.class.model_name.param_key}[assignee_ids][]", default_label: "Assignee"} }
- options[:toggle_class] += ' js-multiselect js-save-user-data'
......@@ -29,7 +29,7 @@
- options[:data][:current_user_info] = current_user.to_json(only: [:id, :name])
= dropdown_tag(users_dropdown_label(issuable.assignees), options: options)
= link_to 'Assign to me', '#', class: "assign-to-me-link #{'hide' if issuable.assignee_ids.split(', ').include?(current_user.id)}"
= link_to 'Assign to me', '#', class: "assign-to-me-link #{'hide' if issuable.assignees.include?(current_user)}"
- else
= form.label :assignee_id, "Assignee", class: "control-label #{"col-lg-4" if has_due_date}"
.col-sm-10{ class: ("col-lg-8" if has_due_date) }
......
......@@ -27,20 +27,24 @@ describe 'New/edit issue', feature: true, js: true do
fill_in 'issue_description', with: 'title'
expect(find('a', text: 'Assign to me')).to be_visible
click_button 'Assignee'
click_button 'Unassigned'
page.within '.dropdown-menu-user' do
click_link user2.name
end
expect(find('input[name="issue[assignee_id]"]', visible: false).value).to match(user2.id.to_s)
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s)
page.within '.js-assignee-search' do
expect(page).to have_content user2.name
end
expect(find('a', text: 'Assign to me')).to be_visible
click_link 'Assign to me'
expect(find('input[name="issue[assignee_id]"]', visible: false).value).to match(user.id.to_s)
assignee_ids = page.all('input[name="issue[assignee_ids][]"]', visible: false)
expect(assignee_ids[0].value).to match(user2.id.to_s)
expect(assignee_ids[1].value).to match(user.id.to_s)
page.within '.js-assignee-search' do
expect(page).to have_content user.name
expect(page).to have_content "#{user2.name} + 1 more"
end
expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible
......@@ -76,7 +80,7 @@ describe 'New/edit issue', feature: true, js: true do
page.within '.issuable-sidebar' do
page.within '.assignee' do
expect(page).to have_content user.name
expect(page).to have_content "2 Assignees"
end
page.within '.milestone' do
......@@ -125,7 +129,7 @@ describe 'New/edit issue', feature: true, js: true do
end
it 'allows user to update issue' do
expect(find('input[name="issue[assignee_id]"]', visible: false).value).to match(user.id.to_s)
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s)
expect(find('input[name="issue[milestone_id]"]', visible: false).value).to match(milestone.id.to_s)
expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible
......
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