diff --git a/test/collections.js b/test/collections.js index 32a1ee1bf..9a4d49ec4 100644 --- a/test/collections.js +++ b/test/collections.js @@ -41,7 +41,7 @@ $(document).ready(function() { var doubled = _([1, 2, 3]).map(function(num){ return num * 2; }); equals(doubled.join(', '), '2, 4, 6', 'OO-style doubled numbers'); - var ids = _.map(document.body.childNodes, function(n){ return n.id; }); + var ids = _.map($('div.underscore-test').children(), function(n){ return n.id; }); ok(_.include(ids, 'qunit-header'), 'can use collection methods on NodeLists'); var ids = _.map(document.images, function(n){ return n.id; }); @@ -197,6 +197,9 @@ $(document).ready(function() { test('collections: toArray', function() { ok(!_.isArray(arguments), 'arguments object is not an array'); ok(_.isArray(_.toArray(arguments)), 'arguments object converted into array'); + var a = [1,2,3]; + ok(_.toArray(a) !== a, 'array is cloned'); + equals(_.toArray(a).join(', '), '1, 2, 3', 'cloned array contains same elements'); var numbers = _.toArray({one : 1, two : 2, three : 3}); equals(numbers.join(', '), '1, 2, 3', 'object flattened into array'); diff --git a/test/test.html b/test/test.html index c67acf596..f8609aa26 100644 --- a/test/test.html +++ b/test/test.html @@ -16,26 +16,27 @@
-
- A representative sample of the functions are benchmarked here, to provide
- a sense of how fast they might run in different browsers.
- Each iteration runs on an array of 1000 elements.
- For example, the 'intersect' test measures the number of times you can
- find the intersection of two thousand-element arrays in one second.
-
+ A representative sample of the functions are benchmarked here, to provide
+ a sense of how fast they might run in different browsers.
+ Each iteration runs on an array of 1000 elements.
+ For example, the 'intersect' test measures the number of times you can
+ find the intersection of two thousand-element arrays in one second.
+