diff --git a/spec/title-bar-element-spec.coffee b/spec/title-bar-element-spec.coffee new file mode 100644 index 000000000..ff8225a9f --- /dev/null +++ b/spec/title-bar-element-spec.coffee @@ -0,0 +1,19 @@ +TitleBar = require '../src/title-bar' +TitleBarElement = require '../src/title-bar-element' + +describe "TitleBarElement", -> + beforeEach -> + atom.views.addViewProvider TitleBar, (model, env) -> + new TitleBarElement().initialize(model, env) + + it 'updates the title based on document.title', -> + titleBar = new TitleBar({item: new TitleBarElement}) + element = atom.views.getView(titleBar) + + expect(element.querySelector('.title').textContent).toBe document.title + + document.title = 'new-title' + element.updateTitle() + + console.log element.querySelector('.title').textContent + expect(element.querySelector('.title').textContent).toBe 'new-title'