diff --git a/spec/app/select-list-spec.coffee b/spec/app/select-list-spec.coffee index 01ffeb445..e4e4d32cc 100644 --- a/spec/app/select-list-spec.coffee +++ b/spec/app/select-list-spec.coffee @@ -59,6 +59,17 @@ describe "SelectList", -> expect(selectList.error).not.toBeVisible() expect(selectList).not.toHaveClass("error") + it "displays no elements until the array has been set on the list", -> + selectList.array = null + selectList.list.empty() + miniEditor.insertText('la') + window.advanceClock(selectList.inputThrottle) + + expect(list.find('li').length).toBe 0 + expect(selectList).not.toHaveClass("error") + selectList.setArray(array) + expect(list.find('li').length).toBe 2 + describe "when core:move-up / core:move-down are triggered on the miniEditor", -> it "selects the previous / next item in the list, or wraps around to the other side", -> expect(list.find('li:first')).toHaveClass 'selected' diff --git a/src/app/select-list.coffee b/src/app/select-list.coffee index 020aaf734..5bdb3258d 100644 --- a/src/app/select-list.coffee +++ b/src/app/select-list.coffee @@ -62,6 +62,8 @@ class SelectList extends View @loading.text(message).show() populateList: -> + return unless @array? + filterQuery = @miniEditor.getText() if filterQuery.length filteredArray = fuzzyFilter(@array, filterQuery, key: @filterKey)