Fixed GFM references not being included when update issue inline

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/2878
This commit is contained in:
Phil Hughes 2017-07-07 18:08:39 +01:00
parent 1dab640357
commit 932b94f911
3 changed files with 17 additions and 0 deletions

View File

@ -30,6 +30,7 @@ class GfmAutoComplete {
this.input.each((i, input) => {
const $input = $(input);
$input.off('focus.setupAtWho').on('focus.setupAtWho', this.setupAtWho.bind(this, $input));
$input.on('change.atwho', () => input.dispatchEvent(new Event('input')));
// This triggers at.js again
// Needed for quick actions with suffixes (ex: /label ~)
$input.on('inserted-commands.atwho', $input.trigger.bind($input, 'keyup'));

View File

@ -0,0 +1,4 @@
---
title: Fixed GFM references not being included when updating issues inline
merge_request:
author:

View File

@ -14,6 +14,18 @@ feature 'GFM autocomplete', feature: true, js: true do
wait_for_requests
end
it 'updates issue descripton with GFM reference' do
find('.issuable-edit').click
find('#issue-description').native.send_keys("@#{user.name[0...3]}")
find('.atwho-view .cur').trigger('click')
click_button 'Save changes'
expect(find('.description')).to have_content(user.to_reference)
end
it 'opens autocomplete menu when field starts with text' do
page.within '.timeline-content-form' do
find('#note_note').native.send_keys('')