Fix pageUp/Down tests by using a real element

This commit is contained in:
Nathan Sobo
2017-04-19 15:52:03 -06:00
committed by Antonio Scandurra
parent f2070ef880
commit 24e03ee4e6
2 changed files with 14 additions and 2 deletions

View File

@@ -5491,7 +5491,11 @@ describe "TextEditor", ->
describe ".pageUp/Down()", ->
it "moves the cursor down one page length", ->
editor.setRowsPerPage(5)
editor.update(autoHeight: false)
element = editor.getElement()
jasmine.attachToDOM(element)
element.style.height = element.component.getLineHeight() * 5 + 'px'
element.measureDimensions()
expect(editor.getCursorBufferPosition().row).toBe 0
@@ -5509,7 +5513,11 @@ describe "TextEditor", ->
describe ".selectPageUp/Down()", ->
it "selects one screen height of text up or down", ->
editor.setRowsPerPage(5)
editor.update(autoHeight: false)
element = editor.getElement()
jasmine.attachToDOM(element)
element.style.height = element.component.getLineHeight() * 5 + 'px'
element.measureDimensions()
expect(editor.getCursorBufferPosition().row).toBe 0

View File

@@ -103,6 +103,10 @@ class TextEditorElement extends HTMLElement {
return this.emitter.on('did-detach', callback)
}
measureDimensions () {
this.getComponent().measureDimensions()
}
setWidth (width) {
this.style.width = this.getComponent().getGutterContainerWidth() + width + 'px'
}