mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Make test use word under cursor
This commit is contained in:
@@ -271,37 +271,37 @@ describe 'FuzzyFinder', ->
|
||||
expect(finder.list.find("li:contains(tree-view.js)")).not.toExist()
|
||||
|
||||
describe "fuzzy find by content under cursor", ->
|
||||
editor = null
|
||||
|
||||
beforeEach ->
|
||||
editor = rootView.getActiveEditor()
|
||||
rootView.attachToDom()
|
||||
spyOn(rootView.project, "getFilePaths").andCallThrough()
|
||||
|
||||
it "opens the fuzzy finder window when there are multiple matches", ->
|
||||
cursor = rootView.getActiveEditor().getCursor()
|
||||
spyOn(cursor, "getCurrentWord").andReturn("sample")
|
||||
editor.setText("sample")
|
||||
rootView.trigger 'fuzzy-finder:find-under-cursor'
|
||||
|
||||
waitsFor ->
|
||||
finder.list.children('li').length > 0
|
||||
|
||||
runs ->
|
||||
expect(rootView.find('.fuzzy-finder')).toExist()
|
||||
expect(finder).toBeVisible()
|
||||
expect(rootView.find('.fuzzy-finder input:focus')).toExist()
|
||||
|
||||
it "opens a file directly when there is a single match", ->
|
||||
cursor = rootView.getActiveEditor().getCursor()
|
||||
spyOn(cursor, "getCurrentWord").andReturn("sample.txt")
|
||||
editor.setText("sample.txt")
|
||||
rootView.trigger 'fuzzy-finder:find-under-cursor'
|
||||
|
||||
openedPath = null
|
||||
spyOn(rootView, "open").andCallFake (path) ->
|
||||
openedPath = path
|
||||
|
||||
rootView.trigger 'fuzzy-finder:find-under-cursor'
|
||||
|
||||
waitsFor ->
|
||||
openedPath != null
|
||||
|
||||
runs ->
|
||||
expect(rootView.find('.fuzzy-finder')).not.toExist()
|
||||
expect(finder).not.toBeVisible()
|
||||
expect(openedPath).toBe "sample.txt"
|
||||
|
||||
describe "opening a path into a split", ->
|
||||
|
||||
Reference in New Issue
Block a user