mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Fix pageUp/Down tests by using a real element
This commit is contained in:
committed by
Antonio Scandurra
parent
f2070ef880
commit
24e03ee4e6
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user