Fixes #3748: Ticket in the ticket creation screen tags are shown after 2 characters, in the ticket zoom after 1 character.

This commit is contained in:
Dominik Klein 2022-04-22 13:33:08 +02:00
parent bb7ff179ed
commit 652d2c27e9
3 changed files with 12 additions and 2 deletions

View file

@ -11,7 +11,7 @@ class App.UiElement.tag
createTokensOnBlur: true createTokensOnBlur: true
autocomplete: { autocomplete: {
source: source source: source
minLength: 2 minLength: 1
response: (e, ui) -> response: (e, ui) ->
return if !ui return if !ui
return if !ui.content return if !ui.content

View file

@ -57,7 +57,7 @@ class App.WidgetTag extends App.Controller
source = "#{App.Config.get('api_path')}/tag_search" source = "#{App.Config.get('api_path')}/tag_search"
@$('.js-newTagInput').autocomplete( @$('.js-newTagInput').autocomplete(
source: source source: source
minLength: 0 minLength: 1
response: (e, ui) => response: (e, ui) =>
return if !ui return if !ui
return if !ui.content return if !ui.content

View file

@ -108,6 +108,16 @@ RSpec.describe 'Knowledge Base Locale Answer Edit', type: :system do
end end
end end
it 'triggers autocomplete after one character' do
within :active_content do
click '.js-newTagLabel'
elem = find('.js-newTagInput')
elem.fill_in with: 'e'
expect(page).to have_css('ul.ui-autocomplete > li.ui-menu-item', minimum: 1)
end
end
it 'shows an existing tag' do it 'shows an existing tag' do
within :active_content do within :active_content do
expect(page).to have_css('a.js-tag', text: published_answer_tag_name) expect(page).to have_css('a.js-tag', text: published_answer_tag_name)