Commit c4602241 authored by Phil Hughes's avatar Phil Hughes

Fixed error with GFM autocomplete when no data exists

parent 358a2d8b
...@@ -367,7 +367,7 @@ ...@@ -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];
}, },
......
---
title: Fixed GFM autocomplete error when no data exists
merge_request:
author:
...@@ -47,7 +47,7 @@ feature 'GFM autocomplete', feature: true, js: true do ...@@ -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 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment