BigW Consortium Gitlab

Commit a4933772 by Phil Hughes

Merge branch…

Merge branch '31987-automatically-close-assignee-select-dropdown-after-selection-when-multiple-assignees-is-disabled' into 'master' Automatically close user dropdown for CE Closes #31987 See merge request !11189
parents 3bbf9575 fbe1e00e
...@@ -421,6 +421,15 @@ function UsersSelect(currentUser, els) { ...@@ -421,6 +421,15 @@ function UsersSelect(currentUser, els) {
selected = $dropdown.closest('.selectbox').find("input[name='" + ($dropdown.data('field-name')) + "']").val(); selected = $dropdown.closest('.selectbox').find("input[name='" + ($dropdown.data('field-name')) + "']").val();
return assignTo(selected); return assignTo(selected);
} }
// Automatically close dropdown after assignee is selected
// since CE has no multiple assignees
// EE does not have a max-select
if ($dropdown.data('max-select') &&
getSelected().length === $dropdown.data('max-select')) {
// Close the dropdown
$dropdown.dropdown('toggle');
}
}, },
id: function (user) { id: function (user) {
return user.id; return user.id;
......
...@@ -115,7 +115,6 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -115,7 +115,6 @@ describe 'Issue Boards', feature: true, js: true do
click_link 'Unassigned' click_link 'Unassigned'
end end
find('.dropdown-menu-toggle').click
wait_for_vue_resource wait_for_vue_resource
expect(page).to have_content('No assignee') expect(page).to have_content('No assignee')
......
...@@ -24,10 +24,10 @@ describe 'New/edit issue', :feature, :js do ...@@ -24,10 +24,10 @@ describe 'New/edit issue', :feature, :js do
visit new_namespace_project_issue_path(project.namespace, project) visit new_namespace_project_issue_path(project.namespace, project)
end end
describe 'multiple assignees' do describe 'single assignee' do
before do before do
click_button 'Unassigned' click_button 'Unassigned'
wait_for_ajax wait_for_ajax
end end
...@@ -36,14 +36,12 @@ describe 'New/edit issue', :feature, :js do ...@@ -36,14 +36,12 @@ describe 'New/edit issue', :feature, :js do
click_link user2.name click_link user2.name
end end
click_button user2.name
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link 'Unassigned' click_link 'Unassigned'
end end
page.within '.js-assignee-search' do
expect(page).to have_content 'Unassigned'
end
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match('0') expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match('0')
end end
...@@ -54,11 +52,13 @@ describe 'New/edit issue', :feature, :js do ...@@ -54,11 +52,13 @@ describe 'New/edit issue', :feature, :js do
expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible
page.within '.dropdown-menu-user' do click_button user.name
page.within('.dropdown-menu-user') do
click_link user.name click_link user.name
end end
expect(find('a', text: 'Assign to me')).to be_visible expect(page.find('.dropdown-menu-user', visible: false)).not_to be_visible
end end
end end
...@@ -154,25 +154,21 @@ describe 'New/edit issue', :feature, :js do ...@@ -154,25 +154,21 @@ describe 'New/edit issue', :feature, :js do
it 'correctly updates the selected user when changing assignee' do it 'correctly updates the selected user when changing assignee' do
click_button 'Unassigned' click_button 'Unassigned'
wait_for_ajax wait_for_ajax
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link user.name click_link user.name
end end
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s) expect(find('.js-assignee-search')).to have_content(user.name)
expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user.id.to_s) click_button user.name
# check the ::before pseudo element to ensure checkmark icon is present
expect(before_for_selector('.dropdown-menu-selectable a.is-active')).not_to eq('')
expect(before_for_selector('.dropdown-menu-selectable a:not(.is-active)')).to eq('')
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
click_link user2.name click_link user2.name
end end
expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s) expect(find('.js-assignee-search')).to have_content(user2.name)
expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user2.id.to_s)
end end
end end
......
...@@ -465,8 +465,6 @@ describe 'Issues', feature: true do ...@@ -465,8 +465,6 @@ describe 'Issues', feature: true do
click_link 'Edit' click_link 'Edit'
click_link @user.name click_link @user.name
find('.dropdown-menu-toggle').click
page.within '.value .author' do page.within '.value .author' do
expect(page).to have_content @user.name expect(page).to have_content @user.name
end end
...@@ -474,8 +472,6 @@ describe 'Issues', feature: true do ...@@ -474,8 +472,6 @@ describe 'Issues', feature: true do
click_link 'Edit' click_link 'Edit'
click_link @user.name click_link @user.name
find('.dropdown-menu-toggle').click
page.within '.value .assign-yourself' do page.within '.value .assign-yourself' do
expect(page).to have_content "No assignee" expect(page).to have_content "No assignee"
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