Editor updates lines when it is resized

This commit is contained in:
Corey Johnson & Nathan Sobo 2012-05-10 11:08:47 -07:00
parent f6e9d99865
commit 22548141d7
2 changed files with 11 additions and 0 deletions

View File

@ -417,6 +417,14 @@ describe "Editor", ->
else
expect(marginBottom).toBe '0px'
it "renders additional lines when the editor is resized", ->
setEditorHeightInLines(editor, 10)
$(window).trigger 'resize'
expect(editor.lines.find('.line').length).toBe 10
expect(editor.lines.find('.line:first').text()).toBe buffer.lineForRow(0)
expect(editor.lines.find('.line:last').text()).toBe buffer.lineForRow(9)
describe "gutter rendering", ->
it "creates a line number element for each line in the buffer", ->
expect(editor.gutter.find('.line-number').length).toEqual(buffer.numLines())

View File

@ -210,6 +210,9 @@ class Editor extends View
else
@gutter.addClass('drop-shadow')
$(window).on "resize", =>
@updateLines()
afterAttach: (onDom) ->
return if @attached or not onDom
@attached = true