Fixed error with GFM autocomplete when no data exists
This commit is contained in:
parent
358a2d8b0d
commit
c460224135
3 changed files with 17 additions and 2 deletions
|
@ -367,7 +367,7 @@
|
||||||
return $input.trigger('keyup');
|
return $input.trigger('keyup');
|
||||||
},
|
},
|
||||||
isLoading(data) {
|
isLoading(data) {
|
||||||
if (!data) return false;
|
if (!data || !data.length) return false;
|
||||||
if (Array.isArray(data)) data = data[0];
|
if (Array.isArray(data)) data = data[0];
|
||||||
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
|
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
|
||||||
},
|
},
|
||||||
|
|
4
changelogs/unreleased/label-gfm-error-fix.yml
Normal file
4
changelogs/unreleased/label-gfm-error-fix.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Fixed GFM autocomplete error when no data exists
|
||||||
|
merge_request:
|
||||||
|
author:
|
|
@ -47,7 +47,7 @@ feature 'GFM autocomplete', feature: true, js: true do
|
||||||
expect_to_wrap(true, label_item, note, label.title)
|
expect_to_wrap(true, label_item, note, label.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not show drpdown when preceded with a special character" do
|
it "does not show dropdown when preceded with a special character" do
|
||||||
note = find('#note_note')
|
note = find('#note_note')
|
||||||
page.within '.timeline-content-form' do
|
page.within '.timeline-content-form' do
|
||||||
note.native.send_keys('')
|
note.native.send_keys('')
|
||||||
|
@ -65,6 +65,17 @@ feature 'GFM autocomplete', feature: true, js: true do
|
||||||
expect(page).to have_selector('.atwho-container', visible: false)
|
expect(page).to have_selector('.atwho-container', visible: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not throw an error if no labels exist" do
|
||||||
|
note = find('#note_note')
|
||||||
|
page.within '.timeline-content-form' do
|
||||||
|
note.native.send_keys('')
|
||||||
|
note.native.send_keys('~')
|
||||||
|
note.click
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(page).to have_selector('.atwho-container', visible: false)
|
||||||
|
end
|
||||||
|
|
||||||
it 'doesn\'t wrap for assignee values' do
|
it 'doesn\'t wrap for assignee values' do
|
||||||
note = find('#note_note')
|
note = find('#note_note')
|
||||||
page.within '.timeline-content-form' do
|
page.within '.timeline-content-form' do
|
||||||
|
|
Loading…
Reference in a new issue