Shows current user on top of filtered dropdown list

This commit is contained in:
Phil Hughes 2017-01-17 10:22:48 -05:00
parent e7fdb1aae5
commit 92682b8ae1
3 changed files with 13 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class AutocompleteController < ApplicationController
if params[:search].blank?
# Include current user if available to filter by "Me"
if params[:current_user].present? && current_user
@users = [*@users, current_user]
@users = [current_user, *@users]
end
if params[:author_id].present?

View file

@ -66,6 +66,12 @@ describe 'Dropdown assignee', js: true, feature: true do
expect(dropdown_assignee_size).to eq(3)
end
it 'shows current user at top of dropdown' do
send_keys_to_filtered_search('assignee:')
expect(first('#js-dropdown-assignee .filter-dropdown li')).to have_content(user.name)
end
end
describe 'filtering' do

View file

@ -66,6 +66,12 @@ describe 'Dropdown author', js: true, feature: true do
expect(dropdown_author_size).to eq(3)
end
it 'shows current user at top of dropdown' do
send_keys_to_filtered_search('author:')
expect(first('#js-dropdown-author li')).to have_content(user.name)
end
end
describe 'filtering' do