TitleBar = require '../src/title-bar'

describe "TitleBar", ->
  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

    atom.workspace.getActivePane().activateItem({
      getTitle: -> 'Test Title'
    })

    expect(document.title).not.toBe(initialTitle)
    expect(titleBar.element.querySelector('.title').textContent).toBe document.title

TitleBar = require '../src/title-bar'

describe "TitleBar", ->
  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

    atom.workspace.getActivePane().activateItem({
      getTitle: -> 'Test Title'
    })

    expect(document.title).not.toBe(initialTitle)
    expect(titleBar.element.querySelector('.title').textContent).toBe document.title

  it "can update the sheet offset for the current window based on its height", ->
    titleBar = new TitleBar({
      workspace: atom.workspace,
      themes: atom.themes,
      applicationDelegate: atom.applicationDelegate,
    })
    expect(->
      titleBar.updateWindowSheetOffset()
    ).not.toThrow()

Test that updateWindowSheetOffset can be called
Test that updateWindowSheetOffset can be called

Testing the wiring to themes isn't worth it, but this at least makes sure we don't break if Electron APIs change.