Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "rquery", | ||
"main": "rquery.js", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ "Andrew Hanna <percyhanna@gmail.com>" |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"repository": { | ||
@@ -16,0 +16,0 @@ "type": "git", |
@@ -26,4 +26,4 @@ [![Build Status](https://travis-ci.org/percyhanna/rquery.svg?branch=master)](https://travis-ci.org/percyhanna/rquery) | ||
var _ = require('lodash'); | ||
var React = require('react/addons); | ||
var $R = require('rquery)(_, React); | ||
var React = require('react/addons'); | ||
var $R = require('rquery')(_, React); | ||
``` | ||
@@ -30,0 +30,0 @@ |
@@ -304,2 +304,23 @@ (function (rquery) { | ||
rquery.prototype.ensureSimulateEvent = function (eventName, eventData) { | ||
if (this.length !== 1) { | ||
var name = 'ensure' + eventName[0].toUpperCase() + eventName.substr(1); | ||
throw new Error('Called ' + name + ', but current context has ' + this.length + ' components. ' + name + ' only works when 1 component is present.'); | ||
} | ||
return this.simulateEvent(eventName, eventData); | ||
} | ||
rquery.prototype.clickAndChange = function (clickData, changeData) { | ||
this.click(clickData); | ||
this.change(changeData); | ||
return this; | ||
}; | ||
rquery.prototype.ensureClickAndChange = function (clickData, changeData) { | ||
this.ensureSimulateEvent('click', clickData); | ||
this.ensureSimulateEvent('change', changeData); | ||
return this; | ||
}; | ||
rquery.prototype.text = function () { | ||
@@ -358,7 +379,3 @@ return _.map(this.components, function(component) { | ||
rquery.prototype[name] = function (eventData) { | ||
if (this.length !== 1) { | ||
throw new Error('Called ' + name + ', but current context has ' + this.length + ' components. ' + name + ' only works when 1 component is present.'); | ||
} | ||
return this.simulateEvent(eventName, eventData); | ||
return this.ensureSimulateEvent(eventName, eventData); | ||
}; | ||
@@ -365,0 +382,0 @@ }); |
37028
867