Skip to content

Commit

Permalink
Merge branch 'master' of github.com:madrobby/zepto
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Feb 15, 2012
2 parents 83ce326 + a8a656f commit ec97396
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/zepto.js
Expand Up @@ -174,7 +174,7 @@ var Zepto = (function() {
else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false); else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false);
return this; return this;
}, },
get: function(idx){ return idx === undefined ? this : this[idx] }, get: function(idx){ return idx === undefined ? slice.call(this) : this[idx] },
size: function(){ return this.length }, size: function(){ return this.length },
remove: function () { remove: function () {
return this.each(function () { return this.each(function () {
Expand Down
15 changes: 15 additions & 0 deletions test/zepto.html
Expand Up @@ -328,6 +328,21 @@ <h1>Zepto DOM unit tests</h1>
t.assertEqualCollection(['a', 'b', 'c'], zepto); t.assertEqualCollection(['a', 'b', 'c'], zepto);
}, },


testGetWithoutIndex: function(t){
var zepto = $('#find1 .findme');
var array = zepto.get();
t.assertFalse(zepto === array);
t.assertTrue($.isArray(array));
t.assertTrue(array.pop === ([]).pop);
},

testGetWithIndex: function(t){
var zepto = $('#find1 .findme');
var outofbounds = zepto.get(zepto.size());
t.assertEqual(zepto.get(0), zepto[0]);
t.assertUndefined(outofbounds);
},

testSize: function(t){ testSize: function(t){
t.assertEqual(4, $('#find1 .findme').size()); t.assertEqual(4, $('#find1 .findme').size());
}, },
Expand Down

0 comments on commit ec97396

Please sign in to comment.