diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index d075fdae9..1bc865754 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -502,6 +502,11 @@ describe "Editor", -> editor.getBuffer().saveAs("/tmp/atom-new.txt") expect(eventHandler).toHaveBeenCalled() + it "loads the grammar for the new path", -> + expect(editor.getGrammar().name).toBe 'JavaScript' + editor.getBuffer().saveAs(path) + expect(editor.getGrammar().name).toBe 'Plain Text' + describe "font size", -> it "sets the initial font size based on the value from config", -> config.set("editor.fontSize", 20) @@ -2091,7 +2096,7 @@ describe "Editor", -> expect(editor.getEditSessions().length).toBe 0 describe ".reloadGrammar()", -> - path = [] + [path] = [] beforeEach -> path = "/tmp/grammar-change.txt" diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 5cf576a29..9a3d38f25 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -505,6 +505,7 @@ class Editor extends View @showBufferConflictAlert(@activeEditSession) @activeEditSession.on "path-changed.editor", => + @reloadGrammar() @trigger 'editor:path-changed' @trigger 'editor:path-changed'