lib/capybara/poltergeist/client/node.coffee in poltergeist-1.6.0 vs lib/capybara/poltergeist/client/node.coffee in poltergeist-1.7.0
- old
+ new
@@ -2,11 +2,11 @@
class Poltergeist.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']
+ 'scrollIntoView', 'isDOMEqual', 'isDisabled', 'deleteText', 'containsSelection', 'path']
constructor: (@page, @id) ->
parent: ->
new Poltergeist.Node(@page, this.parentId())
@@ -50,8 +50,21 @@
position = this.mouseEventPosition()
otherPosition = other.mouseEventPosition()
@page.mouseEvent('mousedown', position.x, position.y)
@page.mouseEvent('mouseup', otherPosition.x, otherPosition.y)
+
+ dragBy: (x, y) ->
+ this.scrollIntoView()
+
+ position = this.mouseEventPosition()
+
+ final_pos =
+ x: position.x + x
+ y: position.y + y
+
+ @page.mouseEvent('mousedown', position.x, position.y)
+ @page.mouseEvent('mouseup', final_pos.x, final_pos.y)
+
isEqual: (other) ->
@page == other.page && this.isDOMEqual(other.id)