Merge branch 'issue-description-gfm' into 'master'

Fixed GFM references not being included when update issue inline

Closes gitlab-ee#2878

See merge request !12720
This commit is contained in:
Filipa Lacerda 2017-07-07 20:00:03 +00:00
commit 4800291cad
3 changed files with 17 additions and 0 deletions

View file

@ -30,6 +30,7 @@ class GfmAutoComplete {
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));
$input.on('change.atwho', () => input.dispatchEvent(new Event('input')));
// This triggers at.js again // This triggers at.js again
// Needed for quick actions with suffixes (ex: /label ~) // Needed for quick actions with suffixes (ex: /label ~)
$input.on('inserted-commands.atwho', $input.trigger.bind($input, 'keyup')); $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 wait_for_requests
end 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 it 'opens autocomplete menu when field starts with text' do
page.within '.timeline-content-form' do page.within '.timeline-content-form' do
find('#note_note').native.send_keys('') find('#note_note').native.send_keys('')