Commit 75892aeb authored by Phil Hughes's avatar Phil Hughes

Added tests for new/edit issue form

parent c752ed06
...@@ -142,8 +142,8 @@ class @UsersSelect ...@@ -142,8 +142,8 @@ class @UsersSelect
selectable: true selectable: true
fieldName: $dropdown.data('field-name') fieldName: $dropdown.data('field-name')
toggleLabel: (selected, el, e, added) -> toggleLabel: (selected, el, e) ->
if selected and 'id' of selected and added if selected and 'id' of selected and $(el).hasClass('is-active')
if selected.text then selected.text else selected.name if selected.text then selected.text else selected.name
else else
defaultLabel defaultLabel
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data} %button.dropdown-menu-toggle.js-label-select.js-multiselect{class: classes.join(' '), type: "button", data: dropdown_data}
%span.dropdown-toggle-text{ class: ("is-default" if selected.nil? || selected.to_a.size == 0) } %span.dropdown-toggle-text{ class: ("is-default" if selected.nil? || selected.to_a.size == 0) }
= h(multi_label_name(selected.to_a, h(selected_toggle.to_a[0]), "Label")) = h(multi_label_name(selected.to_a, h(selected_toggle.to_a[0]), "Labels"))
= icon('chevron-down') = icon('chevron-down')
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
= render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create } = render partial: "shared/issuable/label_page_default", locals: { title: "Filter by label", show_footer: show_footer, show_create: show_create }
......
require 'rails_helper'
describe 'New/edit issue', feature: true, js: true do
let!(:project) { create(:project) }
let!(:user) { create(:user)}
let!(:milestone) { create(:milestone, project: project) }
let!(:label) { create(:label, project: project) }
let!(:label2) { create(:label, project: project) }
let!(:issue) { create(:issue, project: project, assignee: user, milestone: milestone) }
before do
project.team << [user, :master]
login_as(user)
end
context 'new issue' do
before do
visit new_namespace_project_issue_path(project.namespace, project)
end
it 'should allow user to create new issue' do
fill_in 'issue_title', with: 'title'
fill_in 'issue_description', with: 'title'
click_button 'Assignee'
click_link user.name
page.find '.js-assignee-search' do
expect(page).to have_content user.name
end
click_button 'Milestone'
click_link milestone.title
page.find '.js-milestone-select' do
expect(page).to have_content milestone.title
end
click_button 'Labels'
click_link label.title
click_link label2.title
page.find '.js-label-select' do
expect(page).to have_content label2.title
end
click_button 'Submit issue'
page.find '.issuable-sidebar' do
expect(page).to have_content user.name
expect(page).to have_content milestone.title
expect(page).to have_content label.title
expect(page).to have_content label2.title
end
end
end
context 'edit issue' do
before do
visit edit_namespace_project_issue_path(project.namespace, project, issue)
end
it 'should allow user to update issue' do
expect(page).to have_content user.name
expect(page).to have_content milestone.title
click_button 'Labels'
click_link label.title
click_link label2.title
page.find '.js-label-select' do
expect(page).to have_content label2.title
end
click_button 'Save changes'
page.find '.issuable-sidebar' do
expect(page).to have_content user.name
expect(page).to have_content milestone.title
expect(page).to have_content label.title
expect(page).to have_content label2.title
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