       expect(component.lineNodeForScreenRow(2).offsetTop).toBe 2 * lineHeightInPixels
 
       editor.getBuffer().insert([0, 0], '\n\n')
-      nextTick()
+      runSetImmediateCallbacks()
 
       lineNodes = node.querySelectorAll('.line')
       expect(component.lineNodeForScreenRow(0).offsetTop).toBe 0 * lineHeightInPixels

      it "does not render a cursor-line decoration for the last line of a multi-line selection of the selection ends at column 0", ->
        cursor.setScreenPosition([1, 0])
        editor.selectDown(2)
        nextTick()
        expect(lineNumberHasClass(0, 'cursor-line')).toBe false
        expect(lineNumberHasClass(1, 'cursor-line')).toBe true
        expect(lineNumberHasClass(2, 'cursor-line')).toBe true

        expect(foldedLineNode.querySelector('.fold-marker')).toBeFalsy()

        editor.foldBufferRow(4)
        runSetImmediateCallbacks()
        foldedLineNode = component.lineNodeForScreenRow(4)
        expect(foldedLineNode.querySelector('.fold-marker')).toBeTruthy()

        editor.unfoldBufferRow(4)
        runSetImmediateCallbacks()
        foldedLineNode = component.lineNodeForScreenRow(4)
        expect(foldedLineNode.querySelector('.fold-marker')).toBeFalsy()

