mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
192 lines
5.1 KiB
HTML
192 lines
5.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Underscore Test Suite</title>
|
|
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
|
<style>
|
|
iframe {
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="qunit"></div>
|
|
<div id="qunit-fixture">
|
|
<div id="map-test">
|
|
<div id="id1"></div>
|
|
<div id="id2"></div>
|
|
</div>
|
|
<img id="chart_image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">
|
|
</div>
|
|
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
|
<script src="../vendor/jquery/jquery.js"></script>
|
|
<script src="../vendor/platform.js/platform.js"></script>
|
|
<script src="./asset/qunit-extras.js"></script>
|
|
<script src="./asset/test-ui.js"></script>
|
|
<script>
|
|
QUnit.config.asyncRetries = 10;
|
|
QUnit.config.hidepassed = true;
|
|
|
|
// excuse tests we intentionally fail or those with problems
|
|
QUnit.config.excused = {
|
|
'Arrays': {
|
|
'union': [
|
|
'[null,1,2,3]'
|
|
]
|
|
},
|
|
'Chaining': {
|
|
'select/reject/sortBy': [
|
|
'Died on test #1'
|
|
],
|
|
'reverse/concat/unshift/pop/map': [
|
|
'"34, 10, 8, 6, 4, 2, 10, 10"'
|
|
]
|
|
},
|
|
'Collections': {
|
|
'reduce': [
|
|
'handles a null (without initial value) properly',
|
|
'throws an error for empty arrays with no initial value'
|
|
],
|
|
'reduceRight': [
|
|
'handles a null (without initial value) properly',
|
|
'throws an error for empty arrays with no initial value'
|
|
],
|
|
'where': [
|
|
'Only get the first object matched.'
|
|
]
|
|
},
|
|
'Functions': {
|
|
'bind': [
|
|
'can bind without specifying a context',
|
|
'Died on test #2'
|
|
],
|
|
'bindAll': [
|
|
'throws an error for bindAll with no functions named'
|
|
]
|
|
},
|
|
'Objects': {
|
|
'isEqual': [
|
|
'Died on test #63'
|
|
],
|
|
'keys': [
|
|
'throws an error for `null` values',
|
|
'throws an error for `undefined` values',
|
|
'throws an error for number primitives',
|
|
'throws an error for string primitives',
|
|
'throws an error for boolean primitives'
|
|
]
|
|
},
|
|
'Utility': {
|
|
'_.escape': [
|
|
'"<a href="http://moe.com">Curly & Moe's</a>"'
|
|
],
|
|
'_.unescape': [
|
|
'"<a href=\\"http://moe.com\\">Curly & Moe's</a>"'
|
|
],
|
|
'times': [
|
|
'Died on test #1'
|
|
],
|
|
'uniqueId': [
|
|
'Died on test #1'
|
|
]
|
|
}
|
|
};
|
|
|
|
// only excuse in non-Underscore builds
|
|
if (/\bunderscore\b/i.test(ui.buildPath)) {
|
|
delete QUnit.config.excused.Chaining;
|
|
delete QUnit.config.excused.Collections.where;
|
|
delete QUnit.config.excused.Utility['_.escape'];
|
|
delete QUnit.config.excused.Utility['_.unescape'];
|
|
}
|
|
// only excuse in Sauce Labs
|
|
if (location.port != '9001') {
|
|
delete QUnit.config.excused.Objects.isEqual;
|
|
delete QUnit.config.excused.Utility.times;
|
|
delete QUnit.config.excused.Utility.uniqueId;
|
|
}
|
|
|
|
// assign results to `global_test_results` for Sauce Labs
|
|
var global_test_results;
|
|
QUnit.done(function(results) {
|
|
global_test_results = results;
|
|
});
|
|
|
|
// load Lo-Dash and test scripts
|
|
document.write(ui.urlParams.loader != 'none'
|
|
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
|
: ([
|
|
'<script src="' + ui.buildPath + '"><\/script>',
|
|
'<script src="../vendor/underscore/test/collections.js"><\/script>',
|
|
'<script src="../vendor/underscore/test/arrays.js"><\/script>',
|
|
'<script src="../vendor/underscore/test/functions.js"><\/script>',
|
|
'<script src="../vendor/underscore/test/objects.js"><\/script>',
|
|
'<script src="../vendor/underscore/test/utility.js"><\/script>',
|
|
'<script src="../vendor/underscore/test/chaining.js"><\/script>'
|
|
].join('\n'))
|
|
);
|
|
</script>
|
|
<script>
|
|
(function() {
|
|
if (window.curl) {
|
|
curl.config({ 'apiName': 'require' });
|
|
}
|
|
if (!window.require) {
|
|
return;
|
|
}
|
|
var reBasename = /[\w.-]+$/,
|
|
basePath = ('//' + location.host + location.pathname).replace(/\btest\/$/, ''),
|
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
|
locationPath = modulePath.replace(reBasename, ''),
|
|
moduleMain = modulePath.match(reBasename)[0];
|
|
|
|
QUnit.config.autostart = false;
|
|
|
|
// load Lo-Dash as a module
|
|
require({
|
|
'baseUrl': './',
|
|
'urlArgs': 't=' + (+new Date),
|
|
'packages': [
|
|
{
|
|
'name': 'lodash',
|
|
'location': locationPath,
|
|
'main': moduleMain
|
|
},
|
|
{
|
|
'name': 'test',
|
|
'location': '../vendor/underscore/test',
|
|
'config': {
|
|
// work around no global being exported
|
|
'exports': 'QUnit',
|
|
'loader': 'curl/loader/legacy'
|
|
}
|
|
}
|
|
]
|
|
},
|
|
['lodash'], function(lodash) {
|
|
if (ui.isModularize) {
|
|
window._ = lodash;
|
|
}
|
|
require([
|
|
'test/collections',
|
|
'test/arrays',
|
|
'test/functions',
|
|
'test/objects',
|
|
'test/utility',
|
|
'test/chaining'
|
|
], function() {
|
|
QUnit.start();
|
|
});
|
|
});
|
|
}());
|
|
</script>
|
|
<script type="text/html" id="template">
|
|
<%
|
|
// a comment
|
|
if (data) { data += 12345; }; %>
|
|
<li><%= data %></li>
|
|
</script>
|
|
</body>
|
|
</html>
|