         buffer.insert([7, 0], '\n\n')
         buffer.insert([5, 0], '\n\n')
 
-        tokenizedBuffer.on "changed", changeHandler = jasmine.createSpy('changeHandler')
+        tokenizedBuffer.onDidChange changeHandler = jasmine.createSpy('changeHandler')
 
         buffer.setTextInRange([[7, 0], [8, 65]], '    ok')
 

      buffer = atom.project.bufferForPathSync('sample.js')
      tokenizedBuffer = new TokenizedBuffer({buffer})
      startTokenizing(tokenizedBuffer)
      tokenizedBuffer.on "changed", changeHandler = jasmine.createSpy('changeHandler')

    afterEach ->
      tokenizedBuffer.destroy()

        expect(tokenizedBuffer.tokenizedLineForRow(10).indentLevel).toBe 3
        expect(tokenizedBuffer.tokenizedLineForRow(11).indentLevel).toBe 2

        tokenizedBuffer.onDidChange changeHandler = jasmine.createSpy('changeHandler')

        buffer.setTextInRange([[7, 0], [8, 65]], '        one\n        two\n        three\n        four')

