diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index 7d8ea03b3..61da334bb 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -425,6 +425,7 @@ describe "Workspace", -> expect(atom.config.get('editor.fontSize')).toBe 1 workspace.decreaseFontSize() expect(atom.config.get('editor.fontSize')).toBe 1 + describe "::resetFontSize()", -> it "resets the font size to the window's starting font size", -> originalFontSize = 6 @@ -439,6 +440,13 @@ describe "Workspace", -> workspace.resetFontSize() expect(atom.config.get('editor.fontSize')).toBe originalFontSize + it "does nothing if the font size has not been changed", -> + originalFontSize = 6 + + atom.config.set('editor.fontSize', originalFontSize) + workspace.resetFontSize() + expect(atom.config.get('editor.fontSize')).toBe originalFontSize + describe "::openLicense()", -> it "opens the license as plain-text in a buffer", -> waitsForPromise -> workspace.openLicense() diff --git a/src/workspace.coffee b/src/workspace.coffee index 7d460add0..2f70e4316 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -623,7 +623,8 @@ class Workspace extends Model # Restore to the window's original editor font size. resetFontSize: -> - atom.config.set("editor.fontSize", @originalFontSize) + if @originalFontSize + atom.config.set("editor.fontSize", @originalFontSize) # Removes the item's uri from the list of potential items to reopen. itemOpened: (item) ->