Fixed error with GFM autocomplete when no data exists

This commit is contained in:
Phil Hughes 2016-12-23 09:05:01 +00:00
parent 358a2d8b0d
commit c460224135
3 changed files with 17 additions and 2 deletions

View file

@ -367,7 +367,7 @@
return $input.trigger('keyup');
},
isLoading(data) {
if (!data) return false;
if (!data || !data.length) return false;
if (Array.isArray(data)) data = data[0];
return data === this.defaultLoadingData[0] || data.name === this.defaultLoadingData[0];
},

View file

@ -0,0 +1,4 @@
---
title: Fixed GFM autocomplete error when no data exists
merge_request:
author:

View file

@ -47,7 +47,7 @@ feature 'GFM autocomplete', feature: true, js: true do
expect_to_wrap(true, label_item, note, label.title)
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')
page.within '.timeline-content-form' do
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)
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
note = find('#note_note')
page.within '.timeline-content-form' do