Allow GFM autocomplete to be trigger without the preceding space
Closes #19975
This commit is contained in:
parent
8ed9705483
commit
94e0ca0049
2 changed files with 30 additions and 0 deletions
|
@ -84,6 +84,7 @@ GitLab.GfmAutoComplete =
|
|||
@Loading.template
|
||||
insertTpl: ':${name}:'
|
||||
data: ['loading']
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
sorter: @DefaultOptions.sorter
|
||||
filter: @DefaultOptions.filter
|
||||
|
@ -100,6 +101,7 @@ GitLab.GfmAutoComplete =
|
|||
insertTpl: '${atwho-at}${username}'
|
||||
searchKey: 'search'
|
||||
data: ['loading']
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
sorter: @DefaultOptions.sorter
|
||||
filter: @DefaultOptions.filter
|
||||
|
@ -126,6 +128,7 @@ GitLab.GfmAutoComplete =
|
|||
@Loading.template
|
||||
data: ['loading']
|
||||
insertTpl: '${atwho-at}${id}'
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
sorter: @DefaultOptions.sorter
|
||||
filter: @DefaultOptions.filter
|
||||
|
@ -149,6 +152,7 @@ GitLab.GfmAutoComplete =
|
|||
@Loading.template
|
||||
insertTpl: '${atwho-at}"${title}"'
|
||||
data: ['loading']
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
beforeSave: (milestones) ->
|
||||
$.map milestones, (m) ->
|
||||
|
@ -169,6 +173,7 @@ GitLab.GfmAutoComplete =
|
|||
@Loading.template
|
||||
data: ['loading']
|
||||
insertTpl: '${atwho-at}${id}'
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
sorter: @DefaultOptions.sorter
|
||||
filter: @DefaultOptions.filter
|
||||
|
@ -187,6 +192,7 @@ GitLab.GfmAutoComplete =
|
|||
searchKey: 'search'
|
||||
displayTpl: @Labels.template
|
||||
insertTpl: '${atwho-at}${title}'
|
||||
startWithSpace: false
|
||||
callbacks:
|
||||
beforeSave: (merges) ->
|
||||
sanitizeLabelTitle = (title)->
|
||||
|
|
24
spec/features/issues/gfm_autocomplete_spec.rb
Normal file
24
spec/features/issues/gfm_autocomplete_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'GFM autocomplete', feature: true, js: true do
|
||||
let(:user) { create(:user) }
|
||||
let(:project) { create(:project) }
|
||||
let(:issue) { create(:issue, project: project) }
|
||||
|
||||
before do
|
||||
project.team << [user, :master]
|
||||
login_as(user)
|
||||
visit namespace_project_issue_path(project.namespace, project, issue)
|
||||
end
|
||||
|
||||
it 'opens autocomplete menu when doesnt starts with space' do
|
||||
sleep 2
|
||||
|
||||
page.within '.timeline-content-form' do
|
||||
find('#note_note').native.send_keys('testing')
|
||||
find('#note_note').native.send_keys('@')
|
||||
end
|
||||
|
||||
expect(page).to have_selector('.atwho-view')
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue