Skip to content

Commit

Permalink
Merge branch 'master' of github.com:documentcloud/underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed May 9, 2012
2 parents a7215f0 + c43d30f commit c22db85
Show file tree
Hide file tree
Showing 6 changed files with 367 additions and 286 deletions.
4 changes: 2 additions & 2 deletions test/collections.js
Expand Up @@ -44,8 +44,8 @@ $(document).ready(function() {
var doubled = _([1, 2, 3]).map(function(num){ return num * 2; });
equal(doubled.join(', '), '2, 4, 6', 'OO-style doubled numbers');

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($('#map-test').children(), function(n){ return n.id; });
deepEqual(ids, ['id1', 'id2'], 'Can use collection methods on NodeLists.');

var ids = _.map(document.images, function(n){ return n.id; });
ok(ids[0] == 'chart_image', 'can use collection methods on HTMLCollections');
Expand Down
2 changes: 1 addition & 1 deletion test/functions.js
Expand Up @@ -205,7 +205,7 @@ $(document).ready(function() {
var noop = function(){};
var wrapped = _.wrap(noop, function(fn){ return Array.prototype.slice.call(arguments, 0); });
var ret = wrapped(['whats', 'your'], 'vector', 'victor');
same(ret, [noop, ['whats', 'your'], 'vector', 'victor']);
deepEqual(ret, [noop, ['whats', 'your'], 'vector', 'victor']);
});

test("functions: compose", function() {
Expand Down
72 changes: 36 additions & 36 deletions test/test.html
@@ -1,44 +1,44 @@
<!DOCTYPE HTML>
<!doctype html>
<html>
<head>
<title>Underscore Test Suite</title>
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="vendor/jquery.js"></script>
<script type="text/javascript" src="vendor/qunit.js"></script>
<script type="text/javascript" src="vendor/jslitmus.js"></script>
<script type="text/javascript" src="../underscore.js"></script>
<script type="text/javascript" src="collections.js"></script>
<script type="text/javascript" src="arrays.js"></script>
<script type="text/javascript" src="functions.js"></script>
<script type="text/javascript" src="objects.js"></script>
<script type="text/javascript" src="utility.js"></script>
<script type="text/javascript" src="chaining.js"></script>
<script type="text/javascript" src="speed.js"></script>
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen">
<script src="vendor/jquery.js"></script>
<script src="vendor/qunit.js"></script>
<script src="vendor/jslitmus.js"></script>
<script src="../underscore.js"></script>

<script src="collections.js"></script>
<script src="arrays.js"></script>
<script src="functions.js"></script>
<script src="objects.js"></script>
<script src="utility.js"></script>
<script src="chaining.js"></script>
<script src="speed.js"></script>
</head>
<body>
<div class="underscore-test">
<h1 id="qunit-header">Underscore Test Suite</h1>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<br />
<h1 class="qunit-header">Underscore Speed Suite</h1>
<p>
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.<br /><br />
For example, the 'intersect' test measures the number of times you can
find the intersection of two thousand-element arrays in one second.
</p>
<br />

<script type="text/html" id="template">
<%
// a comment
if (data) { data += 12345; }; %>
<li><%= data %></li>
</script>
<div id="qunit"></div>
<div id="qunit-fixture">
<div id="map-test">
<div id="id1"></div>
<div id="id2"></div>
</div>
</div>
<br>
<h1 class="qunit-header">Underscore Speed Suite</h1>
<p>
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.<br /><br />
For example, the 'intersect' test measures the number of times you can
find the intersection of two thousand-element arrays in one second.
</p>
<br>
<script type="text/html" id="template">
<%
// a comment
if (data) { data += 12345; }; %>
<li><%= data %></li>
</script>
</body>
</html>
13 changes: 11 additions & 2 deletions test/vendor/qunit.css
@@ -1,9 +1,9 @@
/**
* QUnit v1.2.0 - A JavaScript Unit Testing Framework
* QUnit v1.5.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2011 John Resig, Jörn Zaefferer
* Copyright (c) 2012 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
Expand Down Expand Up @@ -54,6 +54,10 @@
color: #fff;
}

#qunit-header label {
display: inline-block;
}

#qunit-banner {
height: 5px;
}
Expand Down Expand Up @@ -216,11 +220,16 @@

border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}

/** Fixture */

#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}

0 comments on commit c22db85

Please sign in to comment.