2016-03-28 15:49:26 +03:00
|
|
|
PaneAxis = require '../src/pane-axis'
|
|
|
|
PaneContainer = require '../src/pane-container'
|
|
|
|
Pane = require '../src/pane'
|
|
|
|
|
|
|
|
buildPane = ->
|
|
|
|
new Pane({
|
|
|
|
applicationDelegate: atom.applicationDelegate,
|
|
|
|
config: atom.config,
|
|
|
|
deserializerManager: atom.deserializers,
|
2017-03-21 05:52:01 +03:00
|
|
|
notificationManager: atom.notifications,
|
|
|
|
viewRegistry: atom.views
|
2016-03-28 15:49:26 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
describe "PaneAxisElement", ->
|
|
|
|
it "correctly subscribes and unsubscribes to the underlying model events on attach/detach", ->
|
2017-03-21 05:52:01 +03:00
|
|
|
container = new PaneContainer(config: atom.config, applicationDelegate: atom.applicationDelegate, viewRegistry: atom.views)
|
2017-04-06 02:25:53 +03:00
|
|
|
axis = new PaneAxis({}, atom.views)
|
2016-03-28 15:49:26 +03:00
|
|
|
axis.setContainer(container)
|
2017-04-06 02:50:04 +03:00
|
|
|
axisElement = axis.getElement()
|
2016-03-28 15:49:26 +03:00
|
|
|
|
|
|
|
panes = [buildPane(), buildPane(), buildPane()]
|
|
|
|
|
|
|
|
jasmine.attachToDOM(axisElement)
|
|
|
|
axis.addChild(panes[0])
|
2017-04-06 02:50:04 +03:00
|
|
|
expect(axisElement.children[0]).toBe(panes[0].getElement())
|
2016-03-28 15:49:26 +03:00
|
|
|
|
|
|
|
axisElement.remove()
|
|
|
|
axis.addChild(panes[1])
|
|
|
|
expect(axisElement.children[2]).toBeUndefined()
|
|
|
|
|
|
|
|
jasmine.attachToDOM(axisElement)
|
2017-04-06 02:50:04 +03:00
|
|
|
expect(axisElement.children[2]).toBe(panes[1].getElement())
|
2016-03-28 15:49:26 +03:00
|
|
|
|
|
|
|
axis.addChild(panes[2])
|
2017-04-06 02:50:04 +03:00
|
|
|
expect(axisElement.children[4]).toBe(panes[2].getElement())
|