mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Display error when symbol's file does not exist
This commit is contained in:
@@ -77,8 +77,12 @@ class SymbolsView extends SelectList
|
||||
setTimeout (=> @cancel()), 2000
|
||||
|
||||
confirmed : (tag) ->
|
||||
@cancel()
|
||||
@openTag(tag)
|
||||
if tag.file and not fs.isFile(project.resolve(tag.file))
|
||||
@setError('Selected file does not exist')
|
||||
setTimeout((=> @setError()), 2000)
|
||||
else
|
||||
@cancel()
|
||||
@openTag(tag)
|
||||
|
||||
openTag: (tag) ->
|
||||
position = tag.position
|
||||
|
||||
@@ -201,3 +201,29 @@ describe "SymbolsView", ->
|
||||
expect(symbolsView.list.children('li:last').find('.function-details')).toHaveText 'tagged.js'
|
||||
expect(symbolsView).not.toHaveClass "error"
|
||||
expect(symbolsView.error).not.toBeVisible()
|
||||
|
||||
describe "when selecting a tag", ->
|
||||
describe "when the file doesn't exist", ->
|
||||
renamedPath = null
|
||||
|
||||
beforeEach ->
|
||||
renamedPath = project.resolve("tagged-renamed.js")
|
||||
fs.remove(renamedPath) if fs.exists(renamedPath)
|
||||
fs.move(project.resolve("tagged.js"), renamedPath)
|
||||
|
||||
afterEach ->
|
||||
fs.move(renamedPath, project.resolve("tagged.js"))
|
||||
|
||||
it "doesn't open the editor", ->
|
||||
rootView.trigger "symbols-view:toggle-project-symbols"
|
||||
symbolsView = rootView.find('.symbols-view').view()
|
||||
|
||||
waitsFor ->
|
||||
setArraySpy.callCount > 0
|
||||
|
||||
runs ->
|
||||
spyOn(rootView, 'open').andCallThrough()
|
||||
symbolsView.list.children('li:first').mousedown().mouseup()
|
||||
expect(rootView.open).not.toHaveBeenCalled()
|
||||
expect(symbolsView.error.text().length).toBeGreaterThan 0
|
||||
expect(symbolsView).toHaveClass "error"
|
||||
|
||||
Reference in New Issue
Block a user