mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Update Backbone tests.
This commit is contained in:
@@ -4,15 +4,9 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Backbone Test Suite</title>
|
<title>Backbone Test Suite</title>
|
||||||
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
||||||
<style>
|
|
||||||
body > #qunit-header {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="qunit"></div>
|
<div id="qunit"></div>
|
||||||
<h1 id="qunit-header"></h1>
|
|
||||||
<div id="qunit-fixture">
|
<div id="qunit-fixture">
|
||||||
<div id='testElement'>
|
<div id='testElement'>
|
||||||
<h1>Test</h1>
|
<h1>Test</h1>
|
||||||
@@ -21,49 +15,116 @@
|
|||||||
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
||||||
<script src="../vendor/qunit-extras/qunit-extras.js"></script>
|
<script src="../vendor/qunit-extras/qunit-extras.js"></script>
|
||||||
<script src="../vendor/json-js/json2.js"></script>
|
<script src="../vendor/json-js/json2.js"></script>
|
||||||
<script src="../vendor/jquery/jquery.js"></script>
|
|
||||||
<script src="../vendor/platform.js/platform.js"></script>
|
<script src="../vendor/platform.js/platform.js"></script>
|
||||||
<script src="./asset/test-ui.js"></script>
|
<script src="./asset/test-ui.js"></script>
|
||||||
<script src="../lodash.js"></script>
|
<script src="../lodash.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var lodash = _.noConflict();
|
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.asyncRetries = 10;
|
||||||
QUnit.config.hidepassed = true;
|
QUnit.config.hidepassed = true;
|
||||||
|
|
||||||
// excuse tests we intentionally fail or those with problems
|
// load Lo-Dash
|
||||||
QUnit.config.excused = {
|
if (!ui.isModularize) {
|
||||||
'Backbone.Collection': {
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||||
'set with many models does not overflow the stack': true
|
|
||||||
},
|
|
||||||
'Backbone.Router': {
|
|
||||||
'#2656 - No trailing slash on root.': true,
|
|
||||||
'#2765 - Fragment matching sans query/hash.': true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// only excuse `Backbone.Router` tests in IE < 8
|
|
||||||
if (!(document.attachEvent && (document.documentMode || 0) < 8)) {
|
|
||||||
delete QUnit.config.excused['Backbone.Router'];
|
|
||||||
}
|
}
|
||||||
// load the build of Lo-Dash
|
// load test scripts
|
||||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
document.write(ui.urlParams.loader != 'none'
|
||||||
|
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||||
|
: ([
|
||||||
|
'<script src="' + ui.buildPath + '"><\/script>',
|
||||||
|
'<script src="../vendor/jquery/jquery.js"><\/script>',
|
||||||
|
'<script src="../vendor/backbone/backbone.js"><\/script>',
|
||||||
|
'<script src="../vendor/backbone/test/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>
|
||||||
<script>
|
<script>
|
||||||
_.mixin({
|
(function() {
|
||||||
'debounce': _.debounce || lodash.debounce,
|
if (window.curl) {
|
||||||
'defer': _.defer || lodash.defer,
|
curl.config({ 'apiName': 'require' });
|
||||||
'pluck': _.pluck || lodash.pluck
|
}
|
||||||
});
|
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': '../vendor/jquery/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/environment',
|
||||||
|
'test/noconflict',
|
||||||
|
'test/events',
|
||||||
|
'test/model',
|
||||||
|
'test/collection',
|
||||||
|
'test/router',
|
||||||
|
'test/view',
|
||||||
|
'test/sync'
|
||||||
|
], function() {
|
||||||
|
QUnit.start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
</script>
|
</script>
|
||||||
<script src="../vendor/backbone/backbone.js"></script>
|
|
||||||
<script src="../vendor/backbone/test/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>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
window._ = undefined;
|
window._ = undefined;
|
||||||
removeBizarroMethods();
|
removeBizarroMethods();
|
||||||
}
|
}
|
||||||
// load Lo-Dash and test scripts
|
// load test scripts
|
||||||
document.write(ui.urlParams.loader == 'none'
|
document.write(ui.urlParams.loader == 'none'
|
||||||
? '<script src="' + ui.buildPath + '"><\/script><script src="test.js"><\/script>'
|
? '<script src="' + ui.buildPath + '"><\/script><script src="test.js"><\/script>'
|
||||||
: '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
: '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
delete QUnit.config.excused.Utility['_.escape'];
|
delete QUnit.config.excused.Utility['_.escape'];
|
||||||
delete QUnit.config.excused.Utility['_.unescape'];
|
delete QUnit.config.excused.Utility['_.unescape'];
|
||||||
}
|
}
|
||||||
// load Lo-Dash and test scripts
|
// load test scripts
|
||||||
document.write(ui.urlParams.loader != 'none'
|
document.write(ui.urlParams.loader != 'none'
|
||||||
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
||||||
: ([
|
: ([
|
||||||
@@ -181,7 +181,6 @@
|
|||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|
||||||
// load Lo-Dash as a module
|
|
||||||
require(getConfig(), [moduleId], function(lodash) {
|
require(getConfig(), [moduleId], function(lodash) {
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
window._ = lodash;
|
window._ = lodash;
|
||||||
|
|||||||
Reference in New Issue
Block a user