Comparing version 1.1.3 to 1.1.4
{ | ||
"name": "rquery", | ||
"main": "rquery.js", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ "Andrew Hanna <percyhanna@gmail.com>" |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"repository": { | ||
@@ -16,0 +16,0 @@ "type": "git", |
@@ -272,2 +272,6 @@ (function (rquery) { | ||
rquery.prototype.at = function (index) { | ||
return new rquery(this.components[index]); | ||
}; | ||
rquery.prototype._generate = function (predicate) { | ||
@@ -329,3 +333,7 @@ var matches = [].concat.apply([], this.components.map(function (component) { | ||
$R.isRQuery = function (obj) { | ||
return obj instanceof rquery; | ||
}; | ||
return $R; | ||
})); |
@@ -50,2 +50,40 @@ describe('#findComponent', function () { | ||
describe('#at', function () { | ||
before(function () { | ||
this.$r = $R(['p', 'a']); | ||
}); | ||
describe('when accessing a valid index', function () { | ||
before(function () { | ||
this.value = this.$r.at(0); | ||
}); | ||
it('returns a new rquery object', function () { | ||
expect($R.isRQuery(this.value)).to.equal(true); | ||
}); | ||
it('returns only one item', function () { | ||
expect(this.value.length).to.equal(1); | ||
}); | ||
it('returns the item requested', function () { | ||
expect(this.value[0]).to.equal('p'); | ||
}); | ||
}); | ||
describe('when accessing an invalid index', function () { | ||
before(function () { | ||
this.value = this.$r.at(2); | ||
}); | ||
it('returns an rquery object', function () { | ||
expect($R.isRQuery(this.value)).to.equal(true); | ||
}); | ||
it('returns an empty rquery object', function () { | ||
expect(this.value.length).to.be.equal(0); | ||
}); | ||
}); | ||
}); | ||
describe('#text', function () { | ||
@@ -52,0 +90,0 @@ var TestUtils = React.addons.TestUtils; |
32246
740