Add specs for toggling the gutter when the editor is hidden

This commit is contained in:
Ben Ogle
2014-07-22 17:17:30 -07:00
parent 48a5123202
commit 361f8ec770

View File

@@ -1589,6 +1589,36 @@ describe "EditorComponent", ->
expect(horizontalScrollbarNode.scrollWidth).toBe editor.getScrollWidth()
expect(horizontalScrollbarNode.style.left).toBe gutterNode.offsetWidth + 'px'
describe "when the editor is hidden", ->
hideEditorView = ->
wrapperNode.style.display = 'none'
expect(component.isVisible()).toBe false
showEditorView = ->
wrapperNode.style.display = 'block'
expect(component.isVisible()).toBe true
it "updates the position of the horizontal scrollbar only when the editor is visible", ->
# toggling gutter off
hideEditorView()
atom.config.set("editor.showLineNumbers", false)
showEditorView()
component.forceUpdate()
runSetImmediateCallbacks()
gutterNode = componentNode.querySelector('.gutter')
expect(horizontalScrollbarNode.style.left).toBe '0px'
# toggling gutter back on
hideEditorView()
atom.config.set("editor.showLineNumbers", true)
showEditorView()
component.forceUpdate()
runSetImmediateCallbacks()
gutterNode = componentNode.querySelector('.gutter')
expect(horizontalScrollbarNode.style.left).toBe gutterNode.offsetWidth + 'px'
describe "mousewheel events", ->
beforeEach ->
atom.config.set('editor.scrollSensitivity', 100)