Commit 186487c1 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'cngo-fix-autocomplete-selecting-loading' into 'master'

Fix `@` autocomplete selecting the loading icon

See merge request gitlab-org/gitlab!54925
parents 65c2f58f 766ce607
......@@ -313,10 +313,6 @@ class GfmAutoComplete {
return data;
},
sorter(query, items) {
if (!query) {
return items;
}
// Disable auto-selecting the loading icon
this.setting.highlightFirst = this.setting.alwaysHighlightFirst;
if (GfmAutoComplete.isLoading(items)) {
......@@ -324,6 +320,10 @@ class GfmAutoComplete {
return items;
}
if (!query) {
return items;
}
const lowercaseQuery = query.toLowerCase();
const members = items.slice();
const { nameOrUsernameStartsWith, nameOrUsernameIncludes } = GfmAutoComplete.Members;
......
---
title: Fix `@` autocomplete selecting the loading icon
merge_request: 54925
author:
type: fixed
......@@ -214,6 +214,13 @@ RSpec.describe 'GFM autocomplete', :js do
expect(find_field('Description').value).to have_content "@#{user.username}"
end
it 'does not show `@undefined` when pressing `@` then Enter' do
fill_in 'Description', with: "@\n"
expect(find_field('Description').value).to have_content "@"
expect(find_field('Description').value).not_to have_content "@undefined"
end
it 'selects the first item for non-assignee dropdowns if a query is entered' do
page.within '.timeline-content-form' do
find('#note-body').native.send_keys(':1')
......
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