diff --git a/app/assets/javascripts/app/controllers/_ui_element/tag.coffee b/app/assets/javascripts/app/controllers/_ui_element/tag.coffee index 3889d9263..905c518f2 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/tag.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/tag.coffee @@ -11,7 +11,7 @@ class App.UiElement.tag createTokensOnBlur: true autocomplete: { source: source - minLength: 2 + minLength: 1 response: (e, ui) -> return if !ui return if !ui.content diff --git a/app/assets/javascripts/app/controllers/widget/tag.coffee b/app/assets/javascripts/app/controllers/widget/tag.coffee index 38d1f39d6..c3e528172 100644 --- a/app/assets/javascripts/app/controllers/widget/tag.coffee +++ b/app/assets/javascripts/app/controllers/widget/tag.coffee @@ -57,7 +57,7 @@ class App.WidgetTag extends App.Controller source = "#{App.Config.get('api_path')}/tag_search" @$('.js-newTagInput').autocomplete( source: source - minLength: 0 + minLength: 1 response: (e, ui) => return if !ui return if !ui.content diff --git a/spec/system/knowledge_base/locale/answer/edit_spec.rb b/spec/system/knowledge_base/locale/answer/edit_spec.rb index 399e9ca47..0cc588326 100644 --- a/spec/system/knowledge_base/locale/answer/edit_spec.rb +++ b/spec/system/knowledge_base/locale/answer/edit_spec.rb @@ -108,6 +108,16 @@ RSpec.describe 'Knowledge Base Locale Answer Edit', type: :system do 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 within :active_content do expect(page).to have_css('a.js-tag', text: published_answer_tag_name)