Commit 342434c8 authored by Phil Hughes's avatar Phil Hughes

Fixed issue with de-selecting dropdown option in issue sidebar

Closes #18641
parent bf4455d1
...@@ -116,7 +116,7 @@ class @MilestoneSelect ...@@ -116,7 +116,7 @@ class @MilestoneSelect
.val() .val()
data = {} data = {}
data[abilityName] = {} data[abilityName] = {}
data[abilityName].milestone_id = selected data[abilityName].milestone_id = if selected? then selected else null
$loading $loading
.fadeIn() .fadeIn()
$dropdown.trigger('loading.gl.dropdown') $dropdown.trigger('loading.gl.dropdown')
......
...@@ -31,7 +31,7 @@ class @UsersSelect ...@@ -31,7 +31,7 @@ class @UsersSelect
assignTo = (selected) -> assignTo = (selected) ->
data = {} data = {}
data[abilityName] = {} data[abilityName] = {}
data[abilityName].assignee_id = selected data[abilityName].assignee_id = if selected? then selected else null
$loading $loading
.fadeIn() .fadeIn()
$dropdown.trigger('loading.gl.dropdown') $dropdown.trigger('loading.gl.dropdown')
......
...@@ -396,6 +396,27 @@ describe 'Issues', feature: true do ...@@ -396,6 +396,27 @@ describe 'Issues', feature: true do
expect(page).to have_content @user.name expect(page).to have_content @user.name
end end
end end
it 'allows user to unselect themselves', js: true do
issue2 = create(:issue, project: project, author: @user)
visit namespace_project_issue_path(project.namespace, project, issue2)
page.within '.assignee' do
click_link 'Edit'
click_link @user.name
page.within '.value' do
expect(page).to have_content @user.name
end
click_link 'Edit'
click_link @user.name
page.within '.value' do
expect(page).to have_content "No assignee"
end
end
end
end end
context 'by unauthorized user' do context 'by unauthorized user' do
...@@ -440,6 +461,26 @@ describe 'Issues', feature: true do ...@@ -440,6 +461,26 @@ describe 'Issues', feature: true do
expect(issue.reload.milestone).to be_nil expect(issue.reload.milestone).to be_nil
end end
it 'allows user to de-select milestone', js: true do
visit namespace_project_issue_path(project.namespace, project, issue)
page.within('.milestone') do
click_link 'Edit'
click_link milestone.title
page.within '.value' do
expect(page).to have_content milestone.title
end
click_link 'Edit'
click_link milestone.title
page.within '.value' do
expect(page).to have_content 'None'
end
end
end
end end
context 'by unauthorized user' do context 'by unauthorized user' do
......
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