mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Empty fuzzy-finder list on cancel
This commit is contained in:
@@ -132,11 +132,12 @@ describe "SelectList", ->
|
||||
expect(selectList.confirmed).toHaveBeenCalledWith(array[1])
|
||||
|
||||
describe "the core:cancel event", ->
|
||||
it "triggers the cancelled hook and detaches the select list", ->
|
||||
it "triggers the cancelled hook and detaches and empties the select list", ->
|
||||
spyOn(selectList, 'detach')
|
||||
miniEditor.trigger 'core:cancel'
|
||||
expect(selectList.cancelled).toHaveBeenCalled()
|
||||
expect(selectList.detach).toHaveBeenCalled()
|
||||
expect(selectList.list).toBeEmpty()
|
||||
|
||||
describe "when the mini editor loses focus", ->
|
||||
it "triggers the cancelled hook and detaches the select list", ->
|
||||
@@ -144,13 +145,3 @@ describe "SelectList", ->
|
||||
miniEditor.trigger 'focusout'
|
||||
expect(selectList.cancelled).toHaveBeenCalled()
|
||||
expect(selectList.detach).toHaveBeenCalled()
|
||||
|
||||
describe "when an error occurs on previously populated list", ->
|
||||
it "clears the list", ->
|
||||
selectList.setError("yolo")
|
||||
expect(selectList.list).toBeEmpty()
|
||||
|
||||
describe "when loading is triggered on previously populated list", ->
|
||||
it "clears the list", ->
|
||||
selectList.setLoading("loading yolo")
|
||||
expect(selectList.list).toBeEmpty()
|
||||
|
||||
@@ -48,7 +48,6 @@ class SelectList extends View
|
||||
@error.text("").hide()
|
||||
@removeClass("error")
|
||||
else
|
||||
@list.empty()
|
||||
@error.text(message).show()
|
||||
@addClass("error")
|
||||
|
||||
@@ -56,7 +55,6 @@ class SelectList extends View
|
||||
if not message or message.length == ""
|
||||
@loading.text("").hide()
|
||||
else
|
||||
@list.empty()
|
||||
@setError()
|
||||
@loading.text(message).show()
|
||||
|
||||
@@ -115,6 +113,7 @@ class SelectList extends View
|
||||
@confirmed(element) if element?
|
||||
|
||||
cancel: ->
|
||||
@list.empty()
|
||||
@cancelling = true
|
||||
@cancelled()
|
||||
@detach()
|
||||
|
||||
@@ -51,10 +51,12 @@ class FuzzyFinder extends SelectList
|
||||
@attach() if @paths?.length
|
||||
|
||||
populateProjectPaths: ->
|
||||
return if @array?.length > 0
|
||||
@setLoading("Indexing...")
|
||||
@rootView.project.getFilePaths().done (paths) =>
|
||||
@setArray(paths)
|
||||
if @array?.length > 0
|
||||
@setArray(@array)
|
||||
else
|
||||
@setLoading("Indexing...")
|
||||
@rootView.project.getFilePaths().done (paths) =>
|
||||
@setArray(paths)
|
||||
|
||||
populateOpenBufferPaths: ->
|
||||
@paths = @rootView.getOpenBufferPaths().map (path) =>
|
||||
|
||||
Reference in New Issue
Block a user