mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
118 lines
3.0 KiB
HTML
118 lines
3.0 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Lo-Dash Test Suite</title>
|
|
<link rel="stylesheet" href="../vendor/qunit/qunit/qunit.css">
|
|
<style>
|
|
#exports {
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script src="../vendor/qunit/qunit/qunit.js"></script>
|
|
<script src="../vendor/platform.js/platform.js"></script>
|
|
<script src="test-ui.js"></script>
|
|
<div id="qunit"></div>
|
|
<div id="exports"></div>
|
|
<script>
|
|
// set a bad shim
|
|
Object._keys = Object.keys;
|
|
Object.keys = function() { return []; };
|
|
|
|
// load Lo-Dash and expose it to the bad `Object.keys` shim
|
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
|
</script>
|
|
<script>
|
|
// store Lo-Dash to test for bad shim detection
|
|
var lodashBadShim = window._;
|
|
|
|
// restore nativeKeys
|
|
Object.keys = Object._keys;
|
|
delete Object._keys;
|
|
|
|
// load Lo-Dash again to overwrite the existing `_` value
|
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
|
|
|
// load test.js if not using require.js
|
|
document.write(ui.urlParams.loader != 'none'
|
|
? '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
|
|
: '<script src="test.js"><\/script>'
|
|
);
|
|
</script>
|
|
<script>
|
|
var lodashModule,
|
|
shimmedModule,
|
|
underscoreModule;
|
|
|
|
if (window.curl) {
|
|
var require = curl;
|
|
}
|
|
if (window.require) {
|
|
QUnit.config.autostart = false;
|
|
|
|
// load Lo-Dash as a module
|
|
require((function() {
|
|
var reModularize = /modularize/;
|
|
|
|
var baseUrl = reModularize.test(ui.urlParams.build)
|
|
? '../modularize/'
|
|
: '';
|
|
|
|
var modulePath = reModularize.test(ui.urlParams.build)
|
|
? 'lodash'
|
|
: ui.buildPath.replace(/\.js$/, '');
|
|
|
|
return {
|
|
'baseUrl': baseUrl,
|
|
'urlArgs': 't=' + (+new Date),
|
|
'paths': {
|
|
'lodash': modulePath,
|
|
'shimmed': './abc/../' + modulePath,
|
|
'underscore': './xyz/../' + modulePath
|
|
},
|
|
'aliases': [
|
|
['shimmed', 'lodash'],
|
|
['underscore', 'lodash']
|
|
],
|
|
'shim': {
|
|
'shimmed': {
|
|
'exports': '_'
|
|
}
|
|
}
|
|
};
|
|
}()),
|
|
['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
|
if (shimmed && shimmed.noConflict) {
|
|
shimmedModule = shimmed.noConflict();
|
|
shimmedModule.moduleName = 'shimmed';
|
|
}
|
|
if (underscore && underscore.noConflict) {
|
|
underscoreModule = underscore.noConflict();
|
|
underscoreModule.moduleName = 'underscore';
|
|
}
|
|
if (lodash && lodash.noConflict) {
|
|
lodashModule = lodash.noConflict();
|
|
lodashModule.moduleName = 'lodash';
|
|
}
|
|
require(['test.js'], function() {
|
|
QUnit.start();
|
|
});
|
|
});
|
|
}
|
|
|
|
// set a more readable browser name
|
|
window.onload = function() {
|
|
var timeoutId = setInterval(function() {
|
|
var ua = document.getElementById('qunit-userAgent');
|
|
if (ua) {
|
|
ua.innerHTML = platform;
|
|
clearInterval(timeoutId);
|
|
}
|
|
}, 16);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|