Only reset font size if font size has been changed

This commit is contained in:
Machiste Quintana
2015-04-28 05:49:22 -04:00
parent f4b228c908
commit 12b59cf610
2 changed files with 10 additions and 1 deletions

View File

@@ -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()

View File

@@ -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) ->