 
     afterEach ->
       buffer?.destroy()
-
-    xit "reports the modified status changing to true or false after the user changes buffer", ->
-      modifiedHandler = jasmine.createSpy("modifiedHandler")
-      buffer.onDidChangeModified modifiedHandler
-
-      expect(buffer.isModified()).toBeFalsy()
-      buffer.insert([0,0], "hi")
-      expect(buffer.isModified()).toBe true
-
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
+      modifiedHandler = null
+      doneFunc = null
+
+    describe "after the user changes buffer", ->
+      beforeEach (done) ->
+        doneFunc = done
+        modifiedHandler = jasmine.createSpy("modifiedHandler").and.callFake ->
+          doneFunc()
+        buffer.onDidChangeModified modifiedHandler
+
+        expect(buffer.isModified()).toBeFalsy()
+        buffer.insert([0,0], "hi")
+        expect(buffer.isModified()).toBe true
+
+      beforeEach (done) ->
         expect(modifiedHandler).toHaveBeenCalledWith(true)
 
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
         buffer.insert([0,2], "ho")
-
-      waits buffer.stoppedChangingDelay * 2
-
-      runs ->
-        expect(modifiedHandler).not.toHaveBeenCalled()
-
-        modifiedHandler.reset()
+        setTimeout(->
+          expect(modifiedHandler).not.toHaveBeenCalled()
+          done()
+        , buffer.stoppedChangingDelay * 2)
+
+      it "reports the modified status changing to true or false", (done) ->
+        modifiedHandler.calls.reset()
+        doneFunc = ->
+          expect(modifiedHandler).toHaveBeenCalledWith(false)
+          done()
         buffer.undo()
         buffer.undo()
 
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
-        expect(modifiedHandler).toHaveBeenCalledWith(false)
-
-    xit "reports the modified status changing to false after a modified buffer is saved", ->
-      modifiedHandler = jasmine.createSpy("modifiedHandler")
-      buffer.onDidChangeModified modifiedHandler
-      buffer.insert([0,0], "hi")
-
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
+    describe "after a modified buffer is saved", ->
+      beforeEach (done) ->
+        doneFunc = done
+        modifiedHandler = jasmine.createSpy("modifiedHandler").and.callFake ->
+          doneFunc()
+        buffer.onDidChangeModified modifiedHandler
+        buffer.insert([0,0], "hi")
+
+      it "reports the modified status changing to false", (done) ->
         expect(buffer.isModified()).toBe true
 
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
         buffer.save()
 
         expect(modifiedHandler).toHaveBeenCalledWith(false)
         expect(buffer.isModified()).toBe false
-        modifiedHandler.reset()
-
+        modifiedHandler.calls.reset()
+        doneFunc = ->
+          expect(modifiedHandler).toHaveBeenCalledWith(true)
+          expect(buffer.isModified()).toBe true
+          done()
         buffer.insert([0, 0], 'x')
 
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
-        expect(modifiedHandler).toHaveBeenCalledWith(true)
+    describe "after a modified buffer is reloaded", ->
+      beforeEach (done) ->
+        doneFunc = done
+        modifiedHandler = jasmine.createSpy("modifiedHandler").and.callFake ->
+          doneFunc()
+        buffer.onDidChangeModified modifiedHandler
+        buffer.insert([0,0], "hi")
+
+      it "reports the modified status changing to false after a modified buffer is reloaded", ->
         expect(buffer.isModified()).toBe true
 
-    xit "reports the modified status changing to false after a modified buffer is reloaded", ->
-      modifiedHandler = jasmine.createSpy("modifiedHandler")
-      buffer.onDidChangeModified modifiedHandler
-      buffer.insert([0,0], "hi")
-
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
-        expect(buffer.isModified()).toBe true
-
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
         buffer.reload()
 
         expect(modifiedHandler).toHaveBeenCalledWith(false)
         expect(buffer.isModified()).toBe false
 
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
+        doneFunc = ->
+          expect(modifiedHandler).toHaveBeenCalledWith(true)
+          expect(buffer.isModified()).toBe true
+          done()
         buffer.insert([0, 0], 'x')
 
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
-        expect(modifiedHandler).toHaveBeenCalledWith(true)
-        expect(buffer.isModified()).toBe true
-
-    xit "reports the modified status changing to false after a buffer to a non-existent file is saved", ->
-      buffer.destroy()
-      fs.removeSync(filePath)
-      expect(fs.existsSync(filePath)).toBeFalsy()
-
-      buffer = new TextBuffer({filePath, load: false})
-      modifiedHandler = jasmine.createSpy("modifiedHandler")
-      buffer.load().then ->
-        done()
-
-      runs ->
+    describe "after a buffer to a non-existent file is saved", ->
+      beforeEach (done) ->
+        buffer.destroy()
+        fs.removeSync(filePath)
+        expect(fs.existsSync(filePath)).toBeFalsy()
+
+        buffer = new TextBuffer({filePath, load: false})
+        buffer.load().then ->
+          done()
+
+      beforeEach (done) ->
+        doneFunc = done
+        modifiedHandler = jasmine.createSpy("modifiedHandler").and.callFake ->
+          doneFunc()
         buffer.onDidChangeModified modifiedHandler
         buffer.insert([0,0], "hi")
 
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
+      it "reports the modified status changing to false", (done) ->
         expect(buffer.isModified()).toBe true
 
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
         buffer.save()
 
         expect(fs.existsSync(filePath)).toBeTruthy()
         expect(modifiedHandler).toHaveBeenCalledWith(false)
         expect(buffer.isModified()).toBe false
 
-        modifiedHandler.reset()
+        modifiedHandler.calls.reset()
+        doneFunc = ->
+          expect(modifiedHandler).toHaveBeenCalledWith(true)
+          expect(buffer.isModified()).toBe true
+          done()
         buffer.insert([0, 0], 'x')
-
-      waitsFor ->
-        modifiedHandler.calls.count() is 1
-
-      runs ->
-        expect(modifiedHandler).toHaveBeenCalledWith(true)
-        expect(buffer.isModified()).toBe true
 
     it "returns false for an empty buffer with no path", ->
       buffer.destroy()


      describe "when the serialized buffer had unsaved changes", ->
        describe "when the disk contents were changed since serialization", ->
          xit "loads the disk contents instead of the previous unsaved state", ->
            buffer.setText("BUFFER CHANGE")
            fs.writeFileSync(filePath, "DISK CHANGE")

            buffer2 = buffer.testSerialization()

            waitsFor ->
              buffer2.cachedDiskContents

            runs ->
              expect(buffer2.getPath()).toBe(buffer.getPath())
              expect(buffer2.getText()).toBe("DISK CHANGE")
              expect(buffer2.isModified()).toBeFalsy()

        describe "when the disk contents are the same since serialization", ->
          [previousText] = []

        done()

  describe "modified status", ->
    [filePath, modifiedHandler, doneFunc] = []

    beforeEach (done) ->
      filePath = join(temp.dir, 'atom-tmp-file')
