 
       editor.insertText("def\n")
       expect(editor.lineElementForScreenRow(0).text()).toBe 'def'
-
-  describe ".save()", ->
-    describe "when the current buffer has a path", ->
-      tempFilePath = null
-
-      beforeEach ->
-        tempFilePath = '/tmp/atom-temp.txt'
-        editor.setBuffer new Buffer(tempFilePath)
-        expect(editor.buffer.getPath()).toBe tempFilePath
-
-      afterEach ->
-        expect(fs.remove(tempFilePath))
-
-      it "saves the current buffer to disk", ->
-        editor.buffer.setText 'Edited!'
-        expect(fs.exists(tempFilePath)).toBeFalsy()
-
-        editor.save()
-
-        expect(fs.exists(tempFilePath)).toBeTruthy()
-        expect(fs.read(tempFilePath)).toBe 'Edited!'
-
-    describe "when the current buffer has no path", ->
-      selectedFilePath = null
-      beforeEach ->
-        editor.setBuffer new Buffer()
-        expect(editor.buffer.getPath()).toBeUndefined()
-        editor.buffer.setText 'Save me to a new path'
-        spyOn($native, 'saveDialog').andCallFake -> selectedFilePath
-
-      it "presents a 'save as' dialog", ->
-        editor.save()
-        expect($native.saveDialog).toHaveBeenCalled()
-
-      describe "when a path is chosen", ->
-        it "saves the buffer to the chosen path", ->
-          selectedFilePath = '/tmp/temp.txt'
-
-          editor.save()
-
-          expect(fs.exists(selectedFilePath)).toBeTruthy()
-          expect(fs.read(selectedFilePath)).toBe 'Save me to a new path'
-
-      describe "when dialog is cancelled", ->
-        it "does not save the buffer", ->
-          selectedFilePath = null
-          editor.save()
-          expect(fs.exists(selectedFilePath)).toBeFalsy()
-
-  describe ".spliceLineElements(startRow, rowCount, lineElements)", ->
-    elements = null
-
-    beforeEach ->
-      editor.attachToDom()
-      elements = $$ ->
-        @div "A", class: 'line'
-        @div "B", class: 'line'
-
-    describe "when the start row is 0", ->
-      describe "when the row count is 0", ->
-        it "inserts the given elements before the first row", ->
-          editor.spliceLineElements 0, 0, elements
-
-          expect(editor.renderedLines.find('.line:eq(0)').text()).toBe 'A'
-          expect(editor.renderedLines.find('.line:eq(1)').text()).toBe 'B'
-          expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'var quicksort = function () {'
-
-      describe "when the row count is > 0", ->
-        it "replaces the initial rows with the given elements", ->
-          editor.spliceLineElements 0, 2, elements
-
-          expect(editor.renderedLines.find('.line:eq(0)').text()).toBe 'A'
-          expect(editor.renderedLines.find('.line:eq(1)').text()).toBe 'B'
-          expect(editor.renderedLines.find('.line:eq(2)').text()).toBe '    if (items.length <= 1) return items;'
-
-    describe "when the start row is less than the last row", ->
-      describe "when the row count is 0", ->
-        it "inserts the elements at the specified location", ->
-          editor.spliceLineElements 2, 0, elements
-
-          expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'A'
-          expect(editor.renderedLines.find('.line:eq(3)').text()).toBe 'B'
-          expect(editor.renderedLines.find('.line:eq(4)').text()).toBe '    if (items.length <= 1) return items;'
-
-      describe "when the row count is > 0", ->
-        it "replaces the elements at the specified location", ->
-          editor.spliceLineElements 2, 2, elements
-
-          expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'A'
-          expect(editor.renderedLines.find('.line:eq(3)').text()).toBe 'B'
-          expect(editor.renderedLines.find('.line:eq(4)').text()).toBe '    while(items.length > 0) {'
-
-    describe "when the start row is the last row", ->
-      it "appends the elements to the end of the lines", ->
-        editor.spliceLineElements 13, 0, elements
-
-        expect(editor.renderedLines.find('.line:eq(12)').text()).toBe '};'
-        expect(editor.renderedLines.find('.line:eq(13)').text()).toBe 'A'
-        expect(editor.renderedLines.find('.line:eq(14)').text()).toBe 'B'
-        expect(editor.renderedLines.find('.line:eq(15)')).not.toExist()
 
   describe "switching edit sessions", ->
     [buffer0, buffer1, buffer2] = []

      expect(buffer.subscriptionCount()).toBe 1
      expect(otherBuffer.subscriptionCount()).toBe 1

  describe ".setBuffer(buffer)", ->
    otherBuffer = null


      expect(newEditor.scrollView.scrollLeft()).toBe 44
      newEditor.remove()

  describe "when the editor is attached to the dom", ->
    it "calculates line height and char width and updates the pixel position of the cursor", ->
      expect(editor.lineHeight).toBeNull()
      expect(editor.charWidth).toBeNull()
      editor.setCursorScreenPosition(row: 2, column: 2)

      editor.attachToDom()

      expect(editor.lineHeight).not.toBeNull()
      expect(editor.charWidth).not.toBeNull()
      expect(editor.find('.cursor').offset()).toEqual pagePixelPositionForPoint(editor, [2, 2])

    it "is focused", ->
      editor.attachToDom()
      expect(editor).toMatchSelector ":has(:focus)"

    it "unsubscribes from the buffer when it is removed from the dom", ->
      buffer = new Buffer
      previousSubscriptionCount = buffer.subscriptionCount()

      editor.attachToDom()
      editor.setBuffer(buffer)

      expect(buffer.subscriptionCount()).toBeGreaterThan previousSubscriptionCount
      expect($('.editor')).toExist()
      editor.remove()
      expect(buffer.subscriptionCount()).toBe previousSubscriptionCount
      expect($('.editor')).not.toExist()

  describe "when the editor recieves focus", ->
    it "focuses the hidden input", ->
      editor.attachToDom()
      editor.focus()
      expect(editor).not.toMatchSelector ':focus'
      expect(editor.hiddenInput).toMatchSelector ':focus'

  describe "when the hidden input is focused / unfocused", ->
    it "assigns the isFocused flag on the editor and also adds/removes the .focused css class", ->
      editor.attachToDom()
      editor.isFocused = false
      editor.hiddenInput.focus()
      expect(editor.isFocused).toBeTruthy()
      expect(editor).toHaveClass('focused')

      editor.hiddenInput.focusout()
      expect(editor.isFocused).toBeFalsy()
      expect(editor).not.toHaveClass('focused')

  describe ".remove()", ->
    it "removes subscriptions from all edit session buffers", ->
      otherBuffer = new Buffer(require.resolve('fixtures/sample.txt'))
