Move pane focus handling tests to pane-element-spec

This commit is contained in:
Nathan Sobo 2015-09-03 13:55:31 -06:00
parent b053e95aa7
commit e1b8680e1c
2 changed files with 20 additions and 16 deletions

View File

@ -142,3 +142,23 @@ describe "PaneElement", ->
expect(item2.element.parentElement).toBe paneElement.itemViews
pane.destroyItem(item2)
expect(item2.element.parentElement).toBeNull()
describe "when the pane element is focused", ->
it "transfers focus to the active view", ->
item = document.createElement('div')
item.tabIndex = -1
pane.activateItem(item)
jasmine.attachToDOM(paneElement)
expect(document.activeElement).toBe document.body
paneElement.focus()
expect(document.activeElement).toBe item
it "makes the pane active", ->
pane.splitRight()
expect(pane.isActive()).toBe false
jasmine.attachToDOM(paneElement)
paneElement.focus()
expect(pane.isActive()).toBe true

View File

@ -46,22 +46,6 @@ describe "PaneView", ->
deserializerDisposable.dispose()
jasmine.restoreDeprecationsSnapshot()
describe "when the pane is focused", ->
beforeEach ->
container.attachToDom()
it "transfers focus to the active view", ->
focusHandler = jasmine.createSpy("focusHandler")
pane.getActiveItem().on 'focus', focusHandler
pane.focus()
expect(focusHandler).toHaveBeenCalled()
it "makes the pane active", ->
paneModel.splitRight(items: [pane.copyActiveItem()])
expect(paneModel.isActive()).toBe false
pane.focus()
expect(paneModel.isActive()).toBe true
describe "when a pane is split", ->
it "builds the appropriateatom-pane-axis.horizontal and pane-column views", ->
pane1 = pane