Permalink
Browse files

Merge branch 'master' of https://github.com/sorentwo/zepto into soren…

…two-master
  • Loading branch information...
madrobby committed Jan 12, 2011
2 parents 441c42b + e40d1b7 commit 10770c1d55f8d3550a12c75a917a156cb3cd81df
Showing with 14 additions and 0 deletions.
  1. +1 −0 src/zepto.js
  2. +13 −0 test/zepto.html
View
@@ -63,6 +63,7 @@ var Zepto = (function() {
is: function(selector){
return this.length > 0 && $(this.dom[0]).filter(selector).length > 0;
},
+ eq: function(idx){ return $(this.get(idx)) },
first: function(){ return $(this.get(0)) },
last: function(){ return $(this.get(this.length - 1)) },
find: function(selector){
View
@@ -251,6 +251,19 @@ <h1>Zepto DOM unit tests</h1>
t.assertEqual(4, index);
},
+ testEq: function(t){
+ var zepto = $('h1,p'),
+ zepto2 = zepto.eq(0);
+
+ t.assertLength(5, zepto);
+ t.assertLength(1, zepto2);
+
+ t.refuteIdentical(zepto, zepto2);
+ t.assertUndefined(zepto2.tagName);
+
+ t.assertLength(0, $('nonexistent').eq(0));
+ },
+
testFirst: function(t){
var zepto = $('h1,p');
t.assertLength(5, zepto);

0 comments on commit 10770c1

Please sign in to comment.