mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Do not allow root view to set a font-size less than 1
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user