diff options
author | Phil Hughes <me@iamphill.com> | 2016-12-28 10:19:24 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-12-28 10:19:24 +0000 |
commit | c5757e9afb29f094a37e3ac19f22db4b90fc7670 (patch) | |
tree | b7c2b5c26033d75669879fbfc2eff1cf0bdaa3a3 | |
parent | b93c72e33a50aaed845fe333dee0201b0b11934e (diff) | |
download | gitlab-ce-gfm-new-line-fix.tar.gz |
Fix GFM dropdown not showing at beginning of new linesgfm-new-line-fix
Closes #26145
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js.es6 | 2 | ||||
-rw-r--r-- | changelogs/unreleased/gfm-new-line-fix.yml | 4 | ||||
-rw-r--r-- | spec/features/issues/gfm_autocomplete_spec.rb | 12 |
3 files changed, 17 insertions, 1 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js.es6 b/app/assets/javascripts/gfm_auto_complete.js.es6 index 3857bbb743b..87c579ac757 100644 --- a/app/assets/javascripts/gfm_auto_complete.js.es6 +++ b/app/assets/javascripts/gfm_auto_complete.js.es6 @@ -77,7 +77,7 @@ var _a, _y, regexp, match, atSymbolsWithBar, atSymbolsWithoutBar; atSymbolsWithBar = Object.keys(this.app.controllers).join('|'); atSymbolsWithoutBar = Object.keys(this.app.controllers).join(''); - subtext = subtext.split(' ').pop(); + subtext = subtext.split(/\s+/g).pop(); flag = flag.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); _a = decodeURI("%C3%80"); diff --git a/changelogs/unreleased/gfm-new-line-fix.yml b/changelogs/unreleased/gfm-new-line-fix.yml new file mode 100644 index 00000000000..751bb356b5f --- /dev/null +++ b/changelogs/unreleased/gfm-new-line-fix.yml @@ -0,0 +1,4 @@ +--- +title: Fixed GFM dropdown not showing on new lines +merge_request: +author: diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 3489331a1b6..82c9bd0e6e6 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -47,6 +47,18 @@ feature 'GFM autocomplete', feature: true, js: true do expect_to_wrap(true, label_item, note, label.title) end + it "shows dropdown after a new line" do + note = find('#note_note') + page.within '.timeline-content-form' do + note.native.send_keys('test') + note.native.send_keys(:enter) + note.native.send_keys(:enter) + note.native.send_keys('@') + end + + expect(page).to have_selector('.atwho-container') + end + it "does not show dropdown when preceded with a special character" do note = find('#note_note') page.within '.timeline-content-form' do |