Move octicon values to content property

This commit is contained in:
Kevin Sawicki
2012-12-11 16:56:16 -08:00
parent 641f892493
commit d0a213b2b1
3 changed files with 18 additions and 9 deletions

View File

@@ -141,7 +141,7 @@ describe "StatusBar", ->
it "displays the modified icon for a changed file", ->
fs.write(path, "i've changed for the worse")
rootView.open(path)
expect(statusBar.gitStatusIcon).toHaveText('\uf26d')
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
it "doesn't display the modified icon for an unchanged file", ->
rootView.open(path)
@@ -149,20 +149,20 @@ describe "StatusBar", ->
it "displays the new icon for a new file", ->
rootView.open(newPath)
expect(statusBar.gitStatusIcon).toHaveText('\uf26b')
expect(statusBar.gitStatusIcon).toHaveClass('new-status-icon')
it "updates when a git-status-change event occurs", ->
fs.write(path, "i've changed for the worse")
rootView.open(path)
expect(statusBar.gitStatusIcon).toHaveText('\uf26d')
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
fs.write(path, originalPathText)
rootView.getActiveEditor().getBuffer().trigger 'git-status-change'
expect(statusBar.gitStatusIcon).toHaveText('')
expect(statusBar.gitStatusIcon).not.toHaveClass('modified-status-icon')
it "updates when the window receives focus", ->
fs.write(path, "i've changed for the worse")
rootView.open(path)
expect(statusBar.gitStatusIcon).toHaveText('\uf26d')
expect(statusBar.gitStatusIcon).toHaveClass('modified-status-icon')
fs.write(path, originalPathText)
$(window).trigger 'focus'
expect(statusBar.gitStatusIcon).toHaveText('')
expect(statusBar.gitStatusIcon).not.toHaveClass('modified-status-icon')

View File

@@ -23,7 +23,7 @@ class StatusBar extends View
@span class: 'current-path', outlet: 'currentPath'
@span class: 'buffer-modified', outlet: 'bufferModified'
@div class: 'cursor-position', =>
@span class: 'octicons', outlet: 'gitStatusIcon'
@span outlet: 'gitStatusIcon'
@span outlet: 'branchArea', =>
@span class: 'octicons branch-icon'
@span class: 'branch-label', outlet: 'branchLabel'
@@ -76,10 +76,11 @@ class StatusBar extends View
@gitStatusIcon.empty()
return unless path
@gitStatusIcon.removeClass().addClass('octicons')
if @buffer.getGit()?.isPathModified(path)
@gitStatusIcon.append $$ -> @span '\uf26d', class: 'modified-status-icon'
@gitStatusIcon.addClass('modified-status-icon')
else if @buffer.getGit()?.isPathNew(path)
@gitStatusIcon.append $$ -> @span '\uf26b', class: 'new-status-icon'
@gitStatusIcon.addClass('new-status-icon')
updatePathText: ->
if path = @editor.getPath()

View File

@@ -21,11 +21,19 @@
padding-right: 5px;
}
.status-bar .modified-status-icon:before {
content: "\f26d";
}
.status-bar .new-status-icon {
color: #269F81;
padding-right: 5px;
}
.status-bar .new-status-icon:before {
content: "\f26b";
}
.status-bar .octicons {
font-family: 'Octicons Regular';
font-size: 14px;