Add top/bottom bar specs

This commit is contained in:
simurai
2015-10-24 17:51:12 +09:00
committed by Ben Ogle
parent c2381e05e5
commit b9cea80d4f
2 changed files with 35 additions and 0 deletions

View File

@@ -72,6 +72,11 @@ describe "WorkspaceElement", ->
expect(topContainer.nextSibling).toBe workspaceElement.paneContainer
expect(bottomContainer.previousSibling).toBe workspaceElement.paneContainer
topBarContainer = workspaceElement.querySelector('atom-panel-container.top-bar')
bottomBarContainer = workspaceElement.querySelector('atom-panel-container.bottom-bar')
expect(topBarContainer.nextSibling).toBe workspaceElement.horizontalAxis
expect(bottomBarContainer.previousSibling).toBe workspaceElement.horizontalAxis
modalContainer = workspaceElement.querySelector('atom-panel-container.modal')
expect(modalContainer.parentNode).toBe workspaceElement

View File

@@ -894,6 +894,36 @@ describe "Workspace", ->
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addTopBarPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getTopBarPanels().length).toBe(0)
atom.workspace.panelContainers.topBar.onDidAddPanel addPanelSpy = jasmine.createSpy()
model = new TestItem
panel = atom.workspace.addTopBarPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getTopBarPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addBottomBarPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getBottomBarPanels().length).toBe(0)
atom.workspace.panelContainers.bottomBar.onDidAddPanel addPanelSpy = jasmine.createSpy()
model = new TestItem
panel = atom.workspace.addBottomBarPanel(item: model)
expect(panel).toBeDefined()
expect(addPanelSpy).toHaveBeenCalledWith({panel, index: 0})
itemView = atom.views.getView(atom.workspace.getBottomBarPanels()[0].getItem())
expect(itemView instanceof TestItemElement).toBe(true)
expect(itemView.getModel()).toBe(model)
describe '::addModalPanel(model)', ->
it 'adds a panel to the correct panel container', ->
expect(atom.workspace.getModalPanels().length).toBe(0)