Fix tests in editor

This commit is contained in:
Ben Ogle
2013-11-06 14:13:09 -08:00
parent 0aa0dc01d5
commit 6e049dd173
2 changed files with 6 additions and 3 deletions

View File

@@ -777,6 +777,9 @@ describe "Editor", ->
# resizes with the editor
expect(editor.width()).toBeLessThan(800)
editor.width(800)
editor.resize() # call to trigger the resize event.
region2 = selectionView.regions[1]
expect(region2.width()).toBe(editor.renderedLines.outerWidth())
region3 = selectionView.regions[2]
@@ -1332,7 +1335,7 @@ describe "Editor", ->
setEditorWidthInChars(editor, maxLineLength)
widthBefore = editor.renderedLines.width()
expect(widthBefore).toBe editor.scrollView.width() + 20
buffer.change([[12,0], [12,0]], [1..maxLineLength*2].join(''))
buffer.change([[12,0], [12,0]], [1..maxLineLength*10].join(''))
expect(editor.renderedLines.width()).toBeGreaterThan widthBefore
describe "when lines are removed", ->

View File

@@ -773,8 +773,8 @@ class Editor extends View
@subscribe $(window), "resize.editor-#{@id}", =>
@setHeightInLines()
@setWidthInChars()
@requestDisplayUpdate()
@updateLayerDimensions()
@requestDisplayUpdate()
@focus() if @isFocused
if pane = @getPane()
@@ -1156,7 +1156,7 @@ class Editor extends View
@verticalScrollbarContent.height(@layerHeight)
@scrollBottom(height) if @scrollBottom() > height
minWidth = @scrollView.width()
minWidth = Math.max(@charWidth * @getMaxScreenLineLength() + 20, @scrollView.width())
unless @layerMinWidth == minWidth
@renderedLines.css('min-width', minWidth)
@underlayer.css('min-width', minWidth)