Return default value of true from TextEditor.getAutoHeight

When we need to check for unassigned in the deprecated code path, we
can just read the instance variable directly to avoid getting the
deafult.

Signed-off-by: Antonio Scandurra <as-cii@github.com>
This commit is contained in:
Nathan Sobo 2016-08-17 11:57:35 -06:00
parent 106621e161
commit 13c00995d4
3 changed files with 5 additions and 5 deletions

View File

@ -5507,8 +5507,8 @@ describe "TextEditor", ->
expect(editor.getScrollPastEnd()).toBe(false)
describe "auto height", ->
it "returns undefined by default but can be customized", ->
expect(editor.getAutoHeight()).toBeUndefined()
it "returns true by default but can be customized", ->
expect(editor.getAutoHeight()).toBe(true)
editor.update({autoHeight: false})
expect(editor.getAutoHeight()).toBe(false)
editor.update({autoHeight: true})

View File

@ -57,7 +57,7 @@ class TextEditorComponent
cursorBlinkResumeDelay: @cursorBlinkResumeDelay
stoppedScrollingDelay: 200
lineTopIndex: lineTopIndex
autoHeight: @editor.getAutoHeight() ? true
autoHeight: @editor.getAutoHeight()
@presenter.onDidUpdateState(@requestUpdate)
@ -759,7 +759,7 @@ class TextEditorComponent
# auto-height in certain circumstances. This is legacy behavior that we
# would rather not implement, but we can't remove it without risking
# breakage currently.
unless @editor.getAutoHeight()?
unless @editor.autoHeight?
{position, top, bottom} = getComputedStyle(@hostElement)
hasExplicitTopAndBottom = (position is 'absolute' and top isnt 'auto' and bottom isnt 'auto')

View File

@ -3542,7 +3542,7 @@ class TextEditor extends Model
Grim.deprecate("This is now a view method. Call TextEditorElement::getHeight instead.")
@height
getAutoHeight: -> @autoHeight
getAutoHeight: -> @autoHeight ? true
setWidth: (width, reentrant=false) ->
if reentrant