Commit 617ba013 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix tests for new issuable sidebar

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 6117ae98
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= cross_project_reference(@project, issuable) = cross_project_reference(@project, issuable)
= clipboard_button(clipboard_target: 'span#cross-project-reference') = clipboard_button(clipboard_target: 'span#cross-project-reference')
.block .block.assignee
.title .title
%label %label
Assignee: Assignee:
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
- if issuable.assignee - if issuable.assignee
%strong= link_to_member(@project, issuable.assignee, size: 24) %strong= link_to_member(@project, issuable.assignee, size: 24)
- else - else
none None
.selectbox .selectbox
= users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true, current_user: true, first_user: true) = users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true, current_user: true, first_user: true)
.block .block.milestone
.title .title
%label %label
Milestone: Milestone:
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
= icon('clock-o') = icon('clock-o')
= issuable.milestone.title = issuable.milestone.title
- else - else
none None
.selectbox .selectbox
= f.select(:milestone_id, milestone_options(issuable), { include_blank: true }, { class: 'select2 select2-compact js-select2 js-milestone', data: { placeholder: 'Select milestone' }}) = f.select(:milestone_id, milestone_options(issuable), { include_blank: true }, { class: 'select2 select2-compact js-select2 js-milestone', data: { placeholder: 'Select milestone' }})
= hidden_field_tag :issuable_context = hidden_field_tag :issuable_context
= f.submit class: 'btn hide' = f.submit class: 'btn hide'
- if issuable.labels.any? - if issuable.project.labels.any?
.block .block
.title .title
%label Labels %label Labels
...@@ -53,8 +53,11 @@ ...@@ -53,8 +53,11 @@
.pull-right .pull-right
= link_to 'Edit', '#', class: 'edit-link' = link_to 'Edit', '#', class: 'edit-link'
.value.issuable-show-labels .value.issuable-show-labels
- issuable.labels.each do |label| - if issuable.labels.any?
= link_to_label(label) - issuable.labels.each do |label|
= link_to_label(label)
- else
None
.selectbox .selectbox
= f.collection_select :label_ids, issuable.project.labels.all, :id, :name, = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
{ selected: issuable.label_ids }, multiple: true, class: 'select2 js-select2', data: { placeholder: "Select labels" } { selected: issuable.label_ids }, multiple: true, class: 'select2 js-select2', data: { placeholder: "Select labels" }
......
...@@ -69,7 +69,10 @@ describe 'Issues', feature: true do ...@@ -69,7 +69,10 @@ describe 'Issues', feature: true do
click_button 'Save changes' click_button 'Save changes'
expect(page).to have_content 'Assignee: none' page.within('.assignee') do
expect(page).to have_content 'None'
end
expect(issue.reload.assignee).to be_nil expect(issue.reload.assignee).to be_nil
end end
end end
...@@ -202,7 +205,7 @@ describe 'Issues', feature: true do ...@@ -202,7 +205,7 @@ describe 'Issues', feature: true do
it 'with dropdown menu' do it 'with dropdown menu' do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
find('.context #issue_assignee_id'). find('.issuable-sidebar #issue_assignee_id').
set project.team.members.first.id set project.team.members.first.id
click_button 'Update Issue' click_button 'Update Issue'
...@@ -241,12 +244,16 @@ describe 'Issues', feature: true do ...@@ -241,12 +244,16 @@ describe 'Issues', feature: true do
it 'with dropdown menu' do it 'with dropdown menu' do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
find('.context'). find('.issuable-sidebar').
select(milestone.title, from: 'issue_milestone_id') select(milestone.title, from: 'issue_milestone_id')
click_button 'Update Issue' click_button 'Update Issue'
expect(page).to have_content "Milestone changed to #{milestone.title}" expect(page).to have_content "Milestone changed to #{milestone.title}"
expect(page).to have_content "Milestone: #{milestone.title}"
page.within('.milestone') do
expect(page).to have_content milestone.title
end
has_select?('issue_assignee_id', selected: milestone.title) has_select?('issue_assignee_id', selected: milestone.title)
end end
end end
...@@ -279,13 +286,19 @@ describe 'Issues', feature: true do ...@@ -279,13 +286,19 @@ describe 'Issues', feature: true do
it 'allows user to remove assignee', js: true do it 'allows user to remove assignee', js: true do
visit namespace_project_issue_path(project.namespace, project, issue) visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content "Assignee: #{user2.name}"
first('#s2id_issue_assignee_id').click page.within('.assignee') do
expect(page).to have_content user2.name
end
find('.assignee .edit-link').click
sleep 2 # wait for ajax stuff to complete sleep 2 # wait for ajax stuff to complete
first('.user-result').click first('.user-result').click
expect(page).to have_content 'Assignee: none' page.within('.assignee') do
expect(page).to have_content 'None'
end
sleep 2 # wait for ajax stuff to complete sleep 2 # wait for ajax stuff to complete
expect(issue.reload.assignee).to be_nil expect(issue.reload.assignee).to be_nil
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