lib/capybara/poltergeist/client/compiled/node.js in poltergeist-0.7.0 vs lib/capybara/poltergeist/client/compiled/node.js in poltergeist-1.0.0

- old
+ new

@@ -2,11 +2,11 @@ Poltergeist.Node = (function() { var name, _fn, _i, _len, _ref, _this = this; - Node.DELEGATES = ['text', 'getAttribute', 'value', 'set', 'setAttribute', 'isObsolete', 'removeAttribute', 'isMultiple', 'select', 'tagName', 'find', 'isVisible', 'position', 'trigger', 'parentId', 'clickTest', 'scrollIntoView', 'isDOMEqual']; + Node.DELEGATES = ['text', 'getAttribute', 'value', 'setAttribute', 'isObsolete', 'removeAttribute', 'isMultiple', 'select', 'tagName', 'find', 'isVisible', 'position', 'trigger', 'parentId', 'clickTest', 'scrollIntoView', 'isDOMEqual', 'focusAndHighlight', 'blur']; function Node(page, id) { this.page = page; this.id = id; } @@ -45,27 +45,33 @@ var pos, test; this.scrollIntoView(); pos = this.clickPosition(); test = this.clickTest(pos.x, pos.y); if (test.status === 'success') { - return this.page.sendEvent('click', pos.x, pos.y); + this.page.mouseEvent('click', pos.x, pos.y); + return pos; } else { throw new Poltergeist.ClickFailed(test.selector, pos); } }; Node.prototype.dragTo = function(other) { var otherPosition, position; this.scrollIntoView(); position = this.clickPosition(); 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); + this.page.mouseEvent('mousedown', position.x, position.y); + return this.page.mouseEvent('mouseup', otherPosition.x, otherPosition.y); }; Node.prototype.isEqual = function(other) { return this.page === other.page && this.isDOMEqual(other.id); + }; + + Node.prototype.set = function(value) { + this.focusAndHighlight(); + this.page.sendEvent('keypress', value.toString()); + return this.blur(); }; return Node; }).call(this);