Commit 755745e8 authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Felipe Artur

Merge branch...

Merge branch '27883-autocomplete-seems-to-not-trigger-when-at-character-is-part-of-an-autocompleted-text' into 'master'

Trigger at.js after selecting slash commands with autocomplete suffix

Closes #27883

See merge request !9117
parent d0d5dc8f
...@@ -103,6 +103,9 @@ ...@@ -103,6 +103,9 @@
this.input.each((i, input) => { this.input.each((i, input) => {
const $input = $(input); const $input = $(input);
$input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input)); $input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input));
// This triggers at.js again
// Needed for slash commands with suffixes (ex: /label ~)
$input.on('inserted-commands.atwho', $input.trigger.bind($input, 'keyup'));
}); });
}, },
setupAtWho: function($input) { setupAtWho: function($input) {
......
---
title: Trigger autocomplete after selecting a slash command
merge_request: 9117
author:
...@@ -182,6 +182,20 @@ feature 'GFM autocomplete', feature: true, js: true do ...@@ -182,6 +182,20 @@ feature 'GFM autocomplete', feature: true, js: true do
expect(page).not_to have_selector('.atwho-view') expect(page).not_to have_selector('.atwho-view')
end end
it 'triggers autocomplete after selecting a slash command' do
note = find('#note_note')
page.within '.timeline-content-form' do
note.native.send_keys('')
note.native.send_keys('/as')
note.click
end
find('.atwho-view li', text: '/assign').native.send_keys(:tab)
user_item = find('.atwho-view li', text: user.username)
expect(user_item).to have_content(user.username)
end
def expect_to_wrap(should_wrap, item, note, value) def expect_to_wrap(should_wrap, item, note, value)
expect(item).to have_content(value) expect(item).to have_content(value)
expect(item).not_to have_content("\"#{value}\"") expect(item).not_to have_content("\"#{value}\"")
......
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