mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
134 lines
4.5 KiB
HTML
134 lines
4.5 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Backbone Test Suite</title>
|
|
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
|
</head>
|
|
<body>
|
|
<script>
|
|
// Avoid reporting tests to Sauce Labs when script errors occur.
|
|
if (location.port == '9001') {
|
|
window.onerror = function(message) {
|
|
if (window.QUnit) {
|
|
QUnit.config.done.length = 0;
|
|
}
|
|
global_test_results = { 'message': message };
|
|
};
|
|
}
|
|
</script>
|
|
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
|
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
|
<script src="../vendor/json-js/json2.js"></script>
|
|
<script src="../node_modules/platform/platform.js"></script>
|
|
<script src="./asset/test-ui.js"></script>
|
|
<script src="../lodash.js"></script>
|
|
<script>
|
|
var mixinPrereqs = (function() {
|
|
var lodash = _.noConflict();
|
|
return function(_) {
|
|
_.mixin({
|
|
'debounce': _.debounce || lodash.debounce,
|
|
'defer': _.defer || lodash.defer,
|
|
'pluck': _.pluck || lodash.pluck
|
|
});
|
|
};
|
|
}());
|
|
|
|
QUnit.config.asyncRetries = 10;
|
|
QUnit.config.hidepassed = true;
|
|
|
|
// Load 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="../node_modules/jquery/dist/jquery.js"><\/script>',
|
|
'<script src="../vendor/backbone/backbone.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/setup/dom-setup.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/noconflict.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/events.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/model.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/collection.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/router.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/view.js"><\/script>',
|
|
'<script src="../vendor/backbone/test/sync.js"><\/script>'
|
|
].join('\n'))
|
|
);
|
|
</script>
|
|
<script>
|
|
(function() {
|
|
if (window.curl) {
|
|
curl.config({ 'apiName': 'require' });
|
|
}
|
|
if (!window.require) {
|
|
mixinPrereqs(_);
|
|
return;
|
|
}
|
|
var reBasename = /[\w.-]+$/,
|
|
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
|
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
|
moduleMain = modulePath.match(reBasename)[0],
|
|
uid = +new Date;
|
|
|
|
function getConfig() {
|
|
var result = {
|
|
'baseUrl': './',
|
|
'urlArgs': 't=' + uid++,
|
|
'waitSeconds': 0,
|
|
'paths': {
|
|
'backbone': '../vendor/backbone/backbone',
|
|
'jquery': '../node_modules/jquery/dist/jquery'
|
|
},
|
|
'packages': [{
|
|
'name': 'test',
|
|
'location': '../vendor/backbone/test',
|
|
'config': {
|
|
// Work around no global being exported.
|
|
'exports': 'QUnit',
|
|
'loader': 'curl/loader/legacy'
|
|
}
|
|
}]
|
|
};
|
|
|
|
if (ui.isModularize) {
|
|
result.packages.push({
|
|
'name': 'underscore',
|
|
'location': locationPath,
|
|
'main': moduleMain
|
|
});
|
|
} else {
|
|
result.paths.underscore = modulePath;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
QUnit.config.autostart = false;
|
|
|
|
require(getConfig(), ['underscore', 'backbone'], function(lodash) {
|
|
mixinPrereqs(lodash);
|
|
|
|
if (ui.isModularize) {
|
|
window._ = lodash;
|
|
}
|
|
require(getConfig(), [
|
|
'test/setup/dom-setup',
|
|
'test/setup/environment',
|
|
'test/noconflict',
|
|
'test/events',
|
|
'test/model',
|
|
'test/collection',
|
|
'test/router',
|
|
'test/view',
|
|
'test/sync'
|
|
], function() {
|
|
QUnit.start();
|
|
});
|
|
});
|
|
}());
|
|
</script>
|
|
</body>
|
|
</html>
|