Hide the grammar name when it is the null grammar

This commit is contained in:
Kevin Sawicki
2013-03-23 09:00:54 -07:00
parent e0a93ed1c2
commit 7a56d4080c
2 changed files with 15 additions and 1 deletions

View File

@@ -58,7 +58,11 @@ class StatusBarView extends View
@updateStatusText()
updateGrammarText: ->
@grammarName.text(@editor.getGrammar().name)
grammar = @editor.getGrammar()
if grammar is syntax.nullGrammar
@grammarName.text('').hide()
else
@grammarName.text(grammar.name).show()
updateBufferHasModifiedText: (isModified)->
if isModified

View File

@@ -176,6 +176,16 @@ describe "StatusBar", ->
it "displays the name of the current grammar", ->
expect(statusBar.find('.grammar-name').text()).toBe 'JavaScript'
it "hides the label when the current grammar is the null grammar", ->
rootView.attachToDom()
editor.activeEditSession.languageMode.grammar = syntax.nullGrammar
editor.activeEditSession.trigger 'grammar-changed'
expect(statusBar.find('.grammar-name')).toBeHidden()
expect(statusBar.find('.grammar-name').text()).toBe ''
editor.reloadGrammar()
expect(statusBar.find('.grammar-name')).toBeVisible()
expect(statusBar.find('.grammar-name').text()).toBe 'JavaScript'
describe "when the editor's grammar changes", ->
it "displays the new grammar of the editor", ->
syntax.setGrammarOverrideForPath(editor.getPath(), 'text.plain')