diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index b190e4f54..458366d1d 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -914,11 +914,11 @@ describe "Editor", -> editor.setSelectedBufferRange([[0, 0], [3, 0]]) expect(editor.getSelection().isEmpty()).toBeFalsy() - expect(cursorView.css('visibility')).toBe 'hidden' + expect(cursorView).toBeHidden() editor.setCursorBufferPosition([1, 3]) expect(editor.getSelection().isEmpty()).toBeTruthy() - expect(cursorView.css('visibility')).toBe 'visible' + expect(cursorView).toBeVisible() describe "auto-scrolling", -> it "only auto-scrolls when the last cursor is moved", -> @@ -1773,10 +1773,10 @@ describe "Editor", -> editor.setCursorScreenPosition([2,0]) expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected') - expect(editor.find('.cursor').css('visibility')).toBe 'hidden' + expect(editor.find('.cursor')).toBeHidden() editor.setCursorScreenPosition([3,0]) - expect(editor.find('.cursor').css('visibility')).toBe 'visible' + expect(editor.find('.cursor')).toBeVisible() describe "when a selected fold is scrolled into view (and the fold line was not previously rendered)", -> it "renders the fold's line element with the 'selected' class", -> diff --git a/src/app/cursor-view.coffee b/src/app/cursor-view.coffee index 9495144ae..26d6c7759 100644 --- a/src/app/cursor-view.coffee +++ b/src/app/cursor-view.coffee @@ -61,22 +61,16 @@ class CursorView extends View setVisible: (visible) -> unless @visible == visible @visible = visible - if @visible - @css('visibility', '') - else - @css('visibility', 'hidden') - - toggleVisible: -> - @setVisible(not @visible) + @toggle(@visible) stopBlinking: -> clearInterval(@blinkInterval) if @blinkInterval @blinkInterval = null - @setVisible(@cursor.isVisible()) + this[0].classList.remove('blink-off') startBlinking: -> return if @blinkInterval? - blink = => @toggleVisible() if @cursor.isVisible() + blink = => @toggleClass('blink-off') @blinkInterval = setInterval(blink, @blinkPeriod / 2) resetBlinking: ->