From f2dcf40a2cd69ca56b8e6d6127dd713346423efb Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 21 Jan 2013 14:38:47 -0800 Subject: [PATCH] Make test use word under cursor --- .../fuzzy-finder/spec/fuzzy-finder-spec.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee b/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee index f19ca662f..27cd8a5b5 100644 --- a/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee +++ b/src/packages/fuzzy-finder/spec/fuzzy-finder-spec.coffee @@ -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", ->