Test onDidChangeActivePaneItem observation in title-bar-spec

This commit is contained in:
Nathan Sobo
2016-08-02 16:08:25 -06:00
parent 0c83d9741f
commit 1e81f0ca1c

View File

@@ -1,12 +1,19 @@
TitleBar = require '../src/title-bar'
describe "TitleBar", ->
it 'updates the title based on document.title', ->
titleBar = new TitleBar(atom)
it 'updates the title based on document.title when the active pane item changes', ->
titleBar = new TitleBar({
workspace: atom.workspace,
themes: atom.themes,
applicationDelegate: atom.applicationDelegate,
})
expect(titleBar.element.querySelector('.title').textContent).toBe document.title
initialTitle = document.title
document.title = 'new-title'
titleBar.updateTitle()
atom.workspace.getActivePane().activateItem({
getTitle: -> 'Test Title'
})
expect(titleBar.element.querySelector('.title').textContent).toBe 'new-title'
expect(document.title).not.toBe(initialTitle)
expect(titleBar.element.querySelector('.title').textContent).toBe document.title