mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Hide the grammar name when it is the null grammar
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user