mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Add specs for status bar branch label
This commit is contained in:
committed by
Corey Johnson
parent
8e8ab4ff94
commit
28db13dbc1
@@ -102,3 +102,19 @@ describe "StatusBar", ->
|
||||
it "updates the cursor position in the status bar", ->
|
||||
editor.setCursorScreenPosition([1, 2])
|
||||
expect(statusBar.cursorPosition.text()).toBe '2,3'
|
||||
|
||||
describe "branch label", ->
|
||||
beforeEach ->
|
||||
rootView.attachToDom()
|
||||
|
||||
it "displays the current branch for files in repositories", ->
|
||||
path = require.resolve('fixtures/git/master.git/HEAD')
|
||||
rootView.open(path)
|
||||
expect(statusBar.branchArea).toBeVisible()
|
||||
expect(statusBar.branchLabel.text()).toBe 'master'
|
||||
|
||||
it "doesn't display the current branch for a file not in a repository", ->
|
||||
path = require.resolve('fixtures/git/nohead.git/HEAD')
|
||||
rootView.open(path)
|
||||
expect(statusBar.branchArea).toBeHidden()
|
||||
expect(statusBar.branchLabel.text()).toBe ''
|
||||
|
||||
@@ -60,10 +60,10 @@ class StatusBar extends View
|
||||
if path = @editor.getPath()
|
||||
@head = new Git(path).getShortHead()
|
||||
else
|
||||
@head = null
|
||||
@head = ''
|
||||
|
||||
@branchLabel.text(@head)
|
||||
if @head
|
||||
@branchLabel.text(@head)
|
||||
@branchArea.show()
|
||||
else
|
||||
@branchArea.hide()
|
||||
|
||||
Reference in New Issue
Block a user