diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee index dd813d138..ce676c4ec 100644 --- a/spec/app/root-view-spec.coffee +++ b/spec/app/root-view-spec.coffee @@ -470,3 +470,10 @@ describe "RootView", -> expect(rootView.getFontSize()).toBe fontSizeBefore + 1 rootView.trigger 'decrease-font-size' expect(rootView.getFontSize()).toBe fontSizeBefore + + it "does not allow the font size to be less than 1", -> + rootView.setFontSize(1) + expect(rootView.getFontSize()).toBe 1 + + rootView.setFontSize(0) + expect(rootView.getFontSize()).toBe 1 diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index 9bc9c7eff..6fdeac5f3 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -155,6 +155,7 @@ class RootView extends View super setFontSize: (newFontSize) -> + newFontSize = Math.max(1, newFontSize) [oldFontSize, @fontSize] = [@fontSize, newFontSize] @trigger 'font-size-change' if oldFontSize != newFontSize