Move pane focus transfer test to pane-container-element-spec

This commit is contained in:
Nathan Sobo
2015-09-03 13:29:53 -06:00
parent 4f3db6a271
commit fec21165d0
2 changed files with 18 additions and 24 deletions

View File

@@ -4,16 +4,13 @@ PaneAxis = require '../src/pane-axis'
describe "PaneContainerElement", ->
describe "when panes are added or removed", ->
[paneAxisElement, paneAxis] = []
it "inserts or removes resize elements", ->
childTagNames = ->
child.nodeName.toLowerCase() for child in paneAxisElement.children
beforeEach ->
paneAxis = new PaneAxis
paneAxisElement = new PaneAxisElement().initialize(paneAxis)
childTagNames = ->
child.nodeName.toLowerCase() for child in paneAxisElement.children
it "inserts or removes resize elements", ->
expect(childTagNames()).toEqual []
paneAxis.addChild(new PaneAxis)
@@ -44,6 +41,21 @@ describe "PaneContainerElement", ->
'atom-pane-axis'
]
it "transfers focus to the next pane if a focused pane is removed", ->
container = new PaneContainer
containerElement = atom.views.getView(container)
leftPane = container.getActivePane()
leftPaneElement = atom.views.getView(leftPane)
rightPane = leftPane.splitRight()
rightPaneElement = atom.views.getView(rightPane)
jasmine.attachToDOM(containerElement)
rightPaneElement.focus()
expect(document.activeElement).toBe rightPaneElement
rightPane.destroy()
expect(document.activeElement).toBe leftPaneElement
describe "when the resize element is dragged ", ->
[container, containerElement] = []

View File

@@ -46,24 +46,6 @@ describe "PaneView", ->
deserializerDisposable.dispose()
jasmine.restoreDeprecationsSnapshot()
describe "when a pane is destroyed", ->
[pane2, pane2Model] = []
beforeEach ->
pane2Model = paneModel.splitRight() # Can't destroy the last pane, so we add another
pane2 = atom.views.getView(pane2Model).__spacePenView
describe "if the destroyed pane has focus", ->
[paneToLeft, paneToRight] = []
it "focuses the next pane", ->
container.attachToDom()
pane2.activate()
expect(pane.hasFocus()).toBe false
expect(pane2.hasFocus()).toBe true
pane2Model.destroy()
expect(pane.hasFocus()).toBe true
describe "when the pane's active status changes", ->
[pane2, pane2Model] = []