Don’t require sync update before measuring when autoHeight changes

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Esse commit está contido em:
Nathan Sobo
2015-02-03 13:56:45 -07:00
commit 78b8039384
2 arquivos alterados com 7 adições e 12 exclusões
+2
Ver Arquivo
@@ -2522,6 +2522,7 @@ describe "TextEditorComponent", ->
it "does not assign a height on the component node", ->
wrapperNode.style.height = '200px'
component.measureHeightAndWidth()
nextAnimationFrame()
expect(componentNode.style.height).toBe ''
describe "when the wrapper view does not have an explicit height", ->
@@ -2579,6 +2580,7 @@ describe "TextEditorComponent", ->
it "works with the ::setEditorHeightInLines and ::setEditorWidthInChars helpers", ->
setEditorHeightInLines(wrapperView, 7)
nextAnimationFrame()
expect(componentNode.offsetHeight).toBe lineHeightInPixels * 7
setEditorWidthInChars(wrapperView, 10)
+5 -12
Ver Arquivo
@@ -22,7 +22,6 @@ TextEditorComponent = React.createClass
mixins: [SubscriberMixin]
visible: false
autoHeight: false
pendingScrollTop: null
pendingScrollLeft: null
selectOnMouseMove: false
@@ -54,7 +53,6 @@ TextEditorComponent = React.createClass
hiddenInputStyle = @getHiddenInputPosition()
hiddenInputStyle.WebkitTransform = 'translateZ(0)' if @useHardwareAcceleration
style.height = @presenter.state.height if @presenter.state.height?
if useShadowDOM
@@ -673,20 +671,15 @@ TextEditorComponent = React.createClass
{height} = hostElement.style
if position is 'absolute' or height
if @autoHeight
@autoHeight = false
@presenter.setAutoHeight(false)
@forceUpdate() if not @updatesPaused and @canUpdate()
clientHeight = scrollViewNode.clientHeight
if clientHeight > 0
@presenter.setHeight(clientHeight)
editor.setHeight(clientHeight)
@presenter.setAutoHeight(false)
height = hostElement.offsetHeight
if height > 0
@presenter.setHeight(height)
editor.setHeight(height)
else
@presenter.setAutoHeight(true)
@presenter.setHeight(null)
editor.setHeight(null)
@autoHeight = true
clientWidth = scrollViewNode.clientWidth
paddingLeft = parseInt(getComputedStyle(scrollViewNode).paddingLeft)