 
   describe "when clicking below the last line", ->
     beforeEach ->
-      rootView.attachToDom()
+      editor.attachToDom()
 
     it "move the cursor to the end of the file", ->
       expect(editor.getCursorScreenPosition()).toEqual [0,0]

        config.set("editor.fontSize", 10)
        expect(editor.renderedLines.find(".line").length).toBeGreaterThan originalLineCount

      describe "when the editor is detached", ->
        it "redraws the editor according to the new font size when it is reattached", ->
          rootView.attachToDom()
          rootView.height(200)
          rootView.width(200)

          newEditor = editor.splitRight()
          newEditorParent = newEditor.parent()
          newEditor.detach()
          config.set("editor.fontSize", 10)
          newEditorParent.append(newEditor)

          expect(newEditor.lineHeight).toBe editor.lineHeight
          expect(newEditor.charWidth).toBe editor.charWidth
          expect(newEditor.getCursorView().position()).toEqual editor.getCursorView().position()
          expect(newEditor.verticalScrollbarContent.height()).toBe editor.verticalScrollbarContent.height()

  describe "mouse events", ->
    beforeEach ->

      selectedFilePath = null
      beforeEach ->
        editor.edit(project.buildEditSession())
        editor.getBuffer().setText 'Save me to a new path'
        spyOn(atom, 'showSaveDialog').andCallFake (callback) -> callback(selectedFilePath)

