Permalink
Browse files

Added filter unit tests

  • Loading branch information...
tommy351 committed Sep 4, 2012
1 parent f3c32d4 commit 7087663dbe640b9a28590f4129e68805e276de36
Showing with 41 additions and 0 deletions.
  1. +41 −0 test/filter.js
View
@@ -0,0 +1,41 @@
+var qfs = require('..'),
+ dirname = __dirname,
+ children = qfs(__dirname).children();
+
+describe('Filter', function(){
+ it('eq()', function(done){
+ children.eq(0)[0].should.equal(children[0]);
+
+ done();
+ });
+
+ it('first()', function(done){
+ children.first()[0].should.equal(children[0]);
+
+ done();
+ });
+
+ it('last()', function(done){
+ children.last()[0].should.equal(children[children.length - 1]);
+
+ done();
+ });
+
+ it('slice()', function(done){
+ children.slice(0, 1).length.should.equal(1);
+
+ done();
+ });
+
+ it('filter()', function(done){
+ children.filter('.js').should.be.an.instanceof(qfs);
+
+ done();
+ });
+
+ it('not()', function(done){
+ children.not('.js').should.be.an.instanceof(qfs);
+
+ done();
+ });
+});

0 comments on commit 7087663

Please sign in to comment.