lib/capybara/poltergeist/client/compiled/node.js in poltergeist-1.6.0 vs lib/capybara/poltergeist/client/compiled/node.js in poltergeist-1.7.0
- old
+ new
@@ -2,11 +2,11 @@
Poltergeist.Node = (function() {
var name, _fn, _i, _len, _ref,
_this = this;
- Node.DELEGATES = ['allText', 'visibleText', 'getAttribute', 'value', 'set', 'setAttribute', 'isObsolete', 'removeAttribute', 'isMultiple', 'select', 'tagName', 'find', 'getAttributes', 'isVisible', 'position', 'trigger', 'parentId', 'parentIds', 'mouseEventTest', 'scrollIntoView', 'isDOMEqual', 'isDisabled', 'deleteText', 'containsSelection'];
+ Node.DELEGATES = ['allText', 'visibleText', 'getAttribute', 'value', 'set', 'setAttribute', 'isObsolete', 'removeAttribute', 'isMultiple', 'select', 'tagName', 'find', 'getAttributes', 'isVisible', 'position', 'trigger', 'parentId', 'parentIds', 'mouseEventTest', 'scrollIntoView', 'isDOMEqual', 'isDisabled', 'deleteText', 'containsSelection', 'path'];
function Node(page, id) {
this.page = page;
this.id = id;
}
@@ -64,9 +64,21 @@
this.scrollIntoView();
position = this.mouseEventPosition();
otherPosition = other.mouseEventPosition();
this.page.mouseEvent('mousedown', position.x, position.y);
return this.page.mouseEvent('mouseup', otherPosition.x, otherPosition.y);
+ };
+
+ Node.prototype.dragBy = function(x, y) {
+ var final_pos, position;
+ this.scrollIntoView();
+ position = this.mouseEventPosition();
+ final_pos = {
+ x: position.x + x,
+ y: position.y + y
+ };
+ this.page.mouseEvent('mousedown', position.x, position.y);
+ return this.page.mouseEvent('mouseup', final_pos.x, final_pos.y);
};
Node.prototype.isEqual = function(other) {
return this.page === other.page && this.isDOMEqual(other.id);
};