mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
no need for scrollIntoView param
This commit is contained in:
parent
cb5ecafd7b
commit
9de1a61e83
2 changed files with 10 additions and 13 deletions
|
@ -28,14 +28,8 @@ Poltergeist.Node = (function() {
|
|||
_fn(name);
|
||||
}
|
||||
|
||||
Node.prototype.clickPosition = function(scrollIntoView) {
|
||||
Node.prototype.clickPosition = function() {
|
||||
var middle, pos, viewport;
|
||||
if (scrollIntoView == null) {
|
||||
scrollIntoView = true;
|
||||
}
|
||||
if (scrollIntoView) {
|
||||
this.scrollIntoView();
|
||||
}
|
||||
viewport = this.page.viewportSize();
|
||||
pos = this.position();
|
||||
middle = function(start, end, size) {
|
||||
|
@ -49,6 +43,7 @@ Poltergeist.Node = (function() {
|
|||
|
||||
Node.prototype.click = function() {
|
||||
var pos, test;
|
||||
this.scrollIntoView();
|
||||
pos = this.clickPosition();
|
||||
test = this.clickTest(pos.x, pos.y);
|
||||
if (test.status === 'success') {
|
||||
|
@ -60,8 +55,9 @@ Poltergeist.Node = (function() {
|
|||
|
||||
Node.prototype.dragTo = function(other) {
|
||||
var otherPosition, position;
|
||||
this.scrollIntoView();
|
||||
position = this.clickPosition();
|
||||
otherPosition = other.clickPosition(false);
|
||||
otherPosition = other.clickPosition();
|
||||
this.page.sendEvent('mousedown', position.x, position.y);
|
||||
this.page.sendEvent('mousemove', otherPosition.x, otherPosition.y);
|
||||
return this.page.sendEvent('mouseup', otherPosition.x, otherPosition.y);
|
||||
|
|
|
@ -15,10 +15,7 @@ class Poltergeist.Node
|
|||
this.prototype[name] = (args...) ->
|
||||
@page.nodeCall(@id, name, args)
|
||||
|
||||
clickPosition: (scrollIntoView = true) ->
|
||||
if scrollIntoView
|
||||
this.scrollIntoView()
|
||||
|
||||
clickPosition: ->
|
||||
viewport = @page.viewportSize()
|
||||
pos = this.position()
|
||||
|
||||
|
@ -31,6 +28,8 @@ class Poltergeist.Node
|
|||
}
|
||||
|
||||
click: ->
|
||||
this.scrollIntoView()
|
||||
|
||||
pos = this.clickPosition()
|
||||
test = this.clickTest(pos.x, pos.y)
|
||||
|
||||
|
@ -40,8 +39,10 @@ class Poltergeist.Node
|
|||
throw new Poltergeist.ClickFailed(test.selector, pos)
|
||||
|
||||
dragTo: (other) ->
|
||||
this.scrollIntoView()
|
||||
|
||||
position = this.clickPosition()
|
||||
otherPosition = other.clickPosition(false)
|
||||
otherPosition = other.clickPosition()
|
||||
|
||||
@page.sendEvent('mousedown', position.x, position.y)
|
||||
@page.sendEvent('mousemove', otherPosition.x, otherPosition.y)
|
||||
|
|
Loading…
Add table
Reference in a new issue