mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Adjust tabs to two spaces for html files.
This commit is contained in:
150
perf/index.html
150
perf/index.html
@@ -1,82 +1,82 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>lodash Performance Suite</title>
|
<title>lodash Performance Suite</title>
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
applet {
|
applet {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -9999em;
|
left: -9999em;
|
||||||
}
|
}
|
||||||
#FirebugUI {
|
#FirebugUI {
|
||||||
top: 2em;
|
top: 2em;
|
||||||
}
|
}
|
||||||
#perf-toolbar {
|
#perf-toolbar {
|
||||||
background-color: #EEE;
|
background-color: #EEE;
|
||||||
color: #5E740B;
|
color: #5E740B;
|
||||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
padding: 0.5em 0 0.5em 2em;
|
padding: 0.5em 0 0.5em 2em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="perf-toolbar"></div>
|
<div id="perf-toolbar"></div>
|
||||||
<script src="../node_modules/platform/platform.js"></script>
|
<script src="../node_modules/platform/platform.js"></script>
|
||||||
<script src="../lodash.src.js"></script>
|
<script src="../lodash.src.js"></script>
|
||||||
<script src="../vendor/benchmark.js/benchmark.js"></script>
|
<script src="../vendor/benchmark.js/benchmark.js"></script>
|
||||||
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
||||||
<script src="./asset/perf-ui.js"></script>
|
<script src="./asset/perf-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var lodash = _.noConflict();
|
var lodash = _.noConflict();
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="' + ui.otherPath + '"><\/script>');
|
document.write('<script src="' + ui.otherPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script src="perf.js"></script>
|
<script src="perf.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
var measured,
|
var measured,
|
||||||
perfNow,
|
perfNow,
|
||||||
begin = new Date;
|
begin = new Date;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
var fbUI = document.getElementById('FirebugUI'),
|
var fbUI = document.getElementById('FirebugUI'),
|
||||||
fbDoc = fbUI && (fbDoc = fbUI.contentWindow || fbUI.contentDocument).document || fbDoc,
|
fbDoc = fbUI && (fbDoc = fbUI.contentWindow || fbUI.contentDocument).document || fbDoc,
|
||||||
fbCommandLine = fbDoc && fbDoc.getElementById('fbCommandLine');
|
fbCommandLine = fbDoc && fbDoc.getElementById('fbCommandLine');
|
||||||
|
|
||||||
if (!fbCommandLine) {
|
if (!fbCommandLine) {
|
||||||
return setTimeout(init, 15);
|
return setTimeout(init, 15);
|
||||||
}
|
}
|
||||||
fbUI.style.height = (
|
fbUI.style.height = (
|
||||||
Math.max(document.documentElement.clientHeight, document.body.clientHeight) -
|
Math.max(document.documentElement.clientHeight, document.body.clientHeight) -
|
||||||
document.getElementById('perf-toolbar').clientHeight
|
document.getElementById('perf-toolbar').clientHeight
|
||||||
) + 'px';
|
) + 'px';
|
||||||
|
|
||||||
fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
fbDoc.body.style.height = fbDoc.documentElement.style.height = '100%';
|
||||||
setTimeout(run, 15);
|
setTimeout(run, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the applet permitted?
|
// is the applet permitted?
|
||||||
if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
|
if (!/[?&]nojava=true(?:&|$)/.test(location.search)) {
|
||||||
// is the applet really needed?
|
// is the applet really needed?
|
||||||
while (!(measured = new Date - begin)) {}
|
while (!(measured = new Date - begin)) {}
|
||||||
if (measured > 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) {
|
if (measured > 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) {
|
||||||
// load applet
|
// load applet
|
||||||
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
|
document.write('<applet code="nano" archive="../vendor/benchmark.js/nano.jar"></applet>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.onload = init;
|
window.onload = init;
|
||||||
}());
|
}());
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,133 +1,133 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Backbone Test Suite</title>
|
<title>Backbone Test Suite</title>
|
||||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
// Avoid reporting tests to Sauce Labs when script errors occur.
|
// Avoid reporting tests to Sauce Labs when script errors occur.
|
||||||
if (location.port == '9001') {
|
if (location.port == '9001') {
|
||||||
window.onerror = function(message) {
|
window.onerror = function(message) {
|
||||||
if (window.QUnit) {
|
if (window.QUnit) {
|
||||||
QUnit.config.done.length = 0;
|
QUnit.config.done.length = 0;
|
||||||
}
|
}
|
||||||
global_test_results = { 'message': message };
|
global_test_results = { 'message': message };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||||
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
||||||
<script src="../vendor/json-js/json2.js"></script>
|
<script src="../vendor/json-js/json2.js"></script>
|
||||||
<script src="../node_modules/platform/platform.js"></script>
|
<script src="../node_modules/platform/platform.js"></script>
|
||||||
<script src="./asset/test-ui.js"></script>
|
<script src="./asset/test-ui.js"></script>
|
||||||
<script src="../lodash.src.js"></script>
|
<script src="../lodash.src.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var mixinPrereqs = (function() {
|
var mixinPrereqs = (function() {
|
||||||
var lodash = _.noConflict();
|
var lodash = _.noConflict();
|
||||||
return function(_) {
|
return function(_) {
|
||||||
_.mixin({
|
_.mixin({
|
||||||
'debounce': _.debounce || lodash.debounce,
|
'debounce': _.debounce || lodash.debounce,
|
||||||
'defer': _.defer || lodash.defer,
|
'defer': _.defer || lodash.defer,
|
||||||
'pluck': _.pluck || lodash.pluck
|
'pluck': _.pluck || lodash.pluck
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
QUnit.config.asyncRetries = 10;
|
QUnit.config.asyncRetries = 10;
|
||||||
QUnit.config.hidepassed = true;
|
QUnit.config.hidepassed = true;
|
||||||
|
|
||||||
// Load 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>'
|
||||||
: ([
|
: ([
|
||||||
'<script src="' + ui.buildPath + '"><\/script>',
|
'<script src="' + ui.buildPath + '"><\/script>',
|
||||||
'<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
|
'<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/backbone.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/dom-setup.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
|
'<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/noconflict.js"><\/script>',
|
'<script src="../vendor/backbone/test/noconflict.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/events.js"><\/script>',
|
'<script src="../vendor/backbone/test/events.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/model.js"><\/script>',
|
'<script src="../vendor/backbone/test/model.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/collection.js"><\/script>',
|
'<script src="../vendor/backbone/test/collection.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/router.js"><\/script>',
|
'<script src="../vendor/backbone/test/router.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/view.js"><\/script>',
|
'<script src="../vendor/backbone/test/view.js"><\/script>',
|
||||||
'<script src="../vendor/backbone/test/sync.js"><\/script>'
|
'<script src="../vendor/backbone/test/sync.js"><\/script>'
|
||||||
].join('\n'))
|
].join('\n'))
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
if (window.curl) {
|
if (window.curl) {
|
||||||
curl.config({ 'apiName': 'require' });
|
curl.config({ 'apiName': 'require' });
|
||||||
}
|
}
|
||||||
if (!window.require) {
|
if (!window.require) {
|
||||||
mixinPrereqs(_);
|
mixinPrereqs(_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var reBasename = /[\w.-]+$/,
|
var reBasename = /[\w.-]+$/,
|
||||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||||
moduleMain = modulePath.match(reBasename)[0],
|
moduleMain = modulePath.match(reBasename)[0],
|
||||||
uid = +new Date;
|
uid = +new Date;
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
var result = {
|
var result = {
|
||||||
'baseUrl': './',
|
'baseUrl': './',
|
||||||
'urlArgs': 't=' + uid++,
|
'urlArgs': 't=' + uid++,
|
||||||
'waitSeconds': 0,
|
'waitSeconds': 0,
|
||||||
'paths': {
|
'paths': {
|
||||||
'backbone': '../vendor/backbone/backbone',
|
'backbone': '../vendor/backbone/backbone',
|
||||||
'jquery': '../node_modules/jquery/dist/jquery'
|
'jquery': '../node_modules/jquery/dist/jquery'
|
||||||
},
|
},
|
||||||
'packages': [{
|
'packages': [{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'location': '../vendor/backbone/test',
|
'location': '../vendor/backbone/test',
|
||||||
'config': {
|
'config': {
|
||||||
// Work around no global being exported.
|
// Work around no global being exported.
|
||||||
'exports': 'QUnit',
|
'exports': 'QUnit',
|
||||||
'loader': 'curl/loader/legacy'
|
'loader': 'curl/loader/legacy'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
result.packages.push({
|
result.packages.push({
|
||||||
'name': 'underscore',
|
'name': 'underscore',
|
||||||
'location': locationPath,
|
'location': locationPath,
|
||||||
'main': moduleMain
|
'main': moduleMain
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result.paths.underscore = modulePath;
|
result.paths.underscore = modulePath;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|
||||||
require(getConfig(), ['underscore', 'backbone'], function(lodash) {
|
require(getConfig(), ['underscore', 'backbone'], function(lodash) {
|
||||||
mixinPrereqs(lodash);
|
mixinPrereqs(lodash);
|
||||||
|
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
window._ = lodash;
|
window._ = lodash;
|
||||||
}
|
}
|
||||||
require(getConfig(), [
|
require(getConfig(), [
|
||||||
'test/setup/dom-setup',
|
'test/setup/dom-setup',
|
||||||
'test/setup/environment',
|
'test/setup/environment',
|
||||||
'test/noconflict',
|
'test/noconflict',
|
||||||
'test/events',
|
'test/events',
|
||||||
'test/model',
|
'test/model',
|
||||||
'test/collection',
|
'test/collection',
|
||||||
'test/router',
|
'test/router',
|
||||||
'test/view',
|
'test/view',
|
||||||
'test/sync'
|
'test/sync'
|
||||||
], function() {
|
], function() {
|
||||||
QUnit.start();
|
QUnit.start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
572
test/index.html
572
test/index.html
@@ -1,319 +1,319 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>lodash Test Suite</title>
|
<title>lodash Test Suite</title>
|
||||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||||
<style>
|
<style>
|
||||||
#exports {
|
#exports {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
// Avoid reporting tests to Sauce Labs when script errors occur.
|
// Avoid reporting tests to Sauce Labs when script errors occur.
|
||||||
if (location.port == '9001') {
|
if (location.port == '9001') {
|
||||||
window.onerror = function(message) {
|
window.onerror = function(message) {
|
||||||
if (window.QUnit) {
|
if (window.QUnit) {
|
||||||
QUnit.config.done.length = 0;
|
QUnit.config.done.length = 0;
|
||||||
}
|
}
|
||||||
global_test_results = { 'message': message };
|
global_test_results = { 'message': message };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||||
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
||||||
<script src="../node_modules/platform/platform.js"></script>
|
<script src="../node_modules/platform/platform.js"></script>
|
||||||
<script src="./asset/set.js"></script>
|
<script src="./asset/set.js"></script>
|
||||||
<script src="./asset/weakmap.js"></script>
|
<script src="./asset/weakmap.js"></script>
|
||||||
<script src="./asset/test-ui.js"></script>
|
<script src="./asset/test-ui.js"></script>
|
||||||
<div id="qunit"></div>
|
<div id="qunit"></div>
|
||||||
<div id="exports"></div>
|
<div id="exports"></div>
|
||||||
<script>
|
<script>
|
||||||
var setProperty = (function() {
|
var setProperty = (function() {
|
||||||
var _defineProperty = Object.defineProperty;
|
var _defineProperty = Object.defineProperty;
|
||||||
return function(object, key, value) {
|
return function(object, key, value) {
|
||||||
try {
|
try {
|
||||||
_defineProperty(object, key, {
|
_defineProperty(object, key, {
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'enumerable': false,
|
'enumerable': false,
|
||||||
'writable': true,
|
'writable': true,
|
||||||
'value': value
|
'value': value
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
object[key] = value;
|
object[key] = value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
function addBizarroMethods() {
|
function addBizarroMethods() {
|
||||||
var funcProto = Function.prototype,
|
var funcProto = Function.prototype,
|
||||||
objectProto = Object.prototype,
|
objectProto = Object.prototype,
|
||||||
stringProto = String.prototype;
|
stringProto = String.prototype;
|
||||||
|
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty,
|
var hasOwnProperty = objectProto.hasOwnProperty,
|
||||||
fnToString = funcProto.toString,
|
fnToString = funcProto.toString,
|
||||||
nativeString = fnToString.call(objectProto.toString),
|
nativeString = fnToString.call(objectProto.toString),
|
||||||
noop = function() {},
|
noop = function() {},
|
||||||
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
||||||
reToString = /toString/g;
|
reToString = /toString/g;
|
||||||
|
|
||||||
function constant(value) {
|
function constant(value) {
|
||||||
return function() {
|
return function() {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function createToString(funcName) {
|
function createToString(funcName) {
|
||||||
return constant(nativeString.replace(reToString, funcName));
|
return constant(nativeString.replace(reToString, funcName));
|
||||||
}
|
}
|
||||||
// Allow bypassing native checks.
|
// Allow bypassing native checks.
|
||||||
setProperty(funcProto, 'toString', (function() {
|
setProperty(funcProto, 'toString', (function() {
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
setProperty(funcProto, 'toString', fnToString);
|
setProperty(funcProto, 'toString', fnToString);
|
||||||
var result = hasOwnProperty.call(this, 'toString') ? this.toString() : fnToString.call(this);
|
var result = hasOwnProperty.call(this, 'toString') ? this.toString() : fnToString.call(this);
|
||||||
setProperty(funcProto, 'toString', wrapper);
|
setProperty(funcProto, 'toString', wrapper);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}()));
|
}()));
|
||||||
|
|
||||||
// Add prototype extensions.
|
// Add prototype extensions.
|
||||||
funcProto._method = noop;
|
funcProto._method = noop;
|
||||||
|
|
||||||
// Set bad shims.
|
// Set bad shims.
|
||||||
setProperty(Array, '_isArray', Array.isArray);
|
setProperty(Array, '_isArray', Array.isArray);
|
||||||
setProperty(Array, 'isArray', noop);
|
setProperty(Array, 'isArray', noop);
|
||||||
|
|
||||||
setProperty(Date, '_now', Date.now);
|
setProperty(Date, '_now', Date.now);
|
||||||
setProperty(Date, 'now', noop);
|
setProperty(Date, 'now', noop);
|
||||||
|
|
||||||
setProperty(Object, '_keys', Object.keys);
|
setProperty(Object, '_keys', Object.keys);
|
||||||
setProperty(Object, 'keys', noop);
|
setProperty(Object, 'keys', noop);
|
||||||
|
|
||||||
setProperty(objectProto, '_propertyIsEnumerable', propertyIsEnumerable);
|
setProperty(objectProto, '_propertyIsEnumerable', propertyIsEnumerable);
|
||||||
setProperty(objectProto, 'propertyIsEnumerable', function(key) {
|
setProperty(objectProto, 'propertyIsEnumerable', function(key) {
|
||||||
if (key == '1' && this && typeof this == 'object' &&
|
if (key == '1' && this && typeof this == 'object' &&
|
||||||
hasOwnProperty.call(this, 'callee') &&
|
hasOwnProperty.call(this, 'callee') &&
|
||||||
!propertyIsEnumerable.call(this, 'callee') &&
|
!propertyIsEnumerable.call(this, 'callee') &&
|
||||||
this.length === 2 && this[0] === 1 && this[1] === 0) {
|
this.length === 2 && this[0] === 1 && this[1] === 0) {
|
||||||
throw new Error;
|
throw new Error;
|
||||||
}
|
}
|
||||||
return propertyIsEnumerable.call(this, key);
|
return propertyIsEnumerable.call(this, key);
|
||||||
});
|
});
|
||||||
|
|
||||||
setProperty(window, '_Set', window.Set);
|
setProperty(window, '_Set', window.Set);
|
||||||
setProperty(window, 'Set', noop);
|
setProperty(window, 'Set', noop);
|
||||||
|
|
||||||
setProperty(window, '_WeakMap', window.WeakMap);
|
setProperty(window, '_WeakMap', window.WeakMap);
|
||||||
setProperty(window, 'WeakMap', noop);
|
setProperty(window, 'WeakMap', noop);
|
||||||
|
|
||||||
// Fake `WinRTError`.
|
// Fake `WinRTError`.
|
||||||
setProperty(window, 'WinRTError', Error);
|
setProperty(window, 'WinRTError', Error);
|
||||||
|
|
||||||
// Fake free variable `global`.
|
// Fake free variable `global`.
|
||||||
setProperty(window, 'exports', window);
|
setProperty(window, 'exports', window);
|
||||||
setProperty(window, 'global', window);
|
setProperty(window, 'global', window);
|
||||||
setProperty(window, 'module', {});
|
setProperty(window, 'module', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeBizarroMethods() {
|
function removeBizarroMethods() {
|
||||||
var funcProto = Function.prototype,
|
var funcProto = Function.prototype,
|
||||||
objectProto = Object.prototype,
|
objectProto = Object.prototype,
|
||||||
stringProto = String.prototype;
|
stringProto = String.prototype;
|
||||||
|
|
||||||
if (Array._isArray) {
|
if (Array._isArray) {
|
||||||
setProperty(Array, 'isArray', Array._isArray);
|
setProperty(Array, 'isArray', Array._isArray);
|
||||||
} else {
|
} else {
|
||||||
delete Array.isArray;
|
delete Array.isArray;
|
||||||
}
|
}
|
||||||
if (Date._now) {
|
if (Date._now) {
|
||||||
setProperty(Date, 'now', Date._now);
|
setProperty(Date, 'now', Date._now);
|
||||||
} else {
|
} else {
|
||||||
delete Date.now;
|
delete Date.now;
|
||||||
}
|
}
|
||||||
if (Object._keys) {
|
if (Object._keys) {
|
||||||
setProperty(Object, 'keys', Object._keys);
|
setProperty(Object, 'keys', Object._keys);
|
||||||
} else {
|
} else {
|
||||||
delete Object.keys;
|
delete Object.keys;
|
||||||
}
|
}
|
||||||
if (window._Set) {
|
if (window._Set) {
|
||||||
Set = _Set;
|
Set = _Set;
|
||||||
}
|
}
|
||||||
setProperty(window, '_Set', undefined);
|
setProperty(window, '_Set', undefined);
|
||||||
|
|
||||||
if (window._WeakMap) {
|
if (window._WeakMap) {
|
||||||
WeakMap = _WeakMap;
|
WeakMap = _WeakMap;
|
||||||
}
|
}
|
||||||
setProperty(window, '_WeakMap', undefined);
|
setProperty(window, '_WeakMap', undefined);
|
||||||
|
|
||||||
setProperty(window, 'WinRTError', undefined);
|
setProperty(window, 'WinRTError', undefined);
|
||||||
|
|
||||||
setProperty(window, 'exports', undefined);
|
setProperty(window, 'exports', undefined);
|
||||||
setProperty(window, 'global', undefined);
|
setProperty(window, 'global', undefined);
|
||||||
setProperty(window, 'module', undefined);
|
setProperty(window, 'module', undefined);
|
||||||
|
|
||||||
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
|
setProperty(objectProto, 'propertyIsEnumerable', objectProto._propertyIsEnumerable);
|
||||||
|
|
||||||
delete Array._isArray;
|
delete Array._isArray;
|
||||||
delete Date._now;
|
delete Date._now;
|
||||||
delete Object._keys;
|
delete Object._keys;
|
||||||
delete funcProto._method;
|
delete funcProto._method;
|
||||||
delete objectProto._propertyIsEnumerable;
|
delete objectProto._propertyIsEnumerable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load lodash to expose it to the bad extensions/shims.
|
// Load lodash to expose it to the bad extensions/shims.
|
||||||
if (!ui.isModularize) {
|
if (!ui.isModularize) {
|
||||||
addBizarroMethods();
|
addBizarroMethods();
|
||||||
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// Store lodash to test for bad extensions/shims.
|
// Store lodash to test for bad extensions/shims.
|
||||||
if (!ui.isModularize) {
|
if (!ui.isModularize) {
|
||||||
var lodashBizarro = window._;
|
var lodashBizarro = window._;
|
||||||
window._ = undefined;
|
window._ = undefined;
|
||||||
removeBizarroMethods();
|
removeBizarroMethods();
|
||||||
}
|
}
|
||||||
// Load test scripts.
|
// Load test scripts.
|
||||||
document.write((ui.isForeign || ui.urlParams.loader == 'none')
|
document.write((ui.isForeign || 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>'
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var lodashModule,
|
var lodashModule,
|
||||||
shimmedModule,
|
shimmedModule,
|
||||||
underscoreModule;
|
underscoreModule;
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
if (window.curl) {
|
if (window.curl) {
|
||||||
curl.config({ 'apiName': 'require' });
|
curl.config({ 'apiName': 'require' });
|
||||||
}
|
}
|
||||||
if (ui.isForeign || !window.require) {
|
if (ui.isForeign || !window.require) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var reBasename = /[\w.-]+$/,
|
var reBasename = /[\w.-]+$/,
|
||||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
moduleMain = modulePath.match(reBasename)[0],
|
moduleMain = modulePath.match(reBasename)[0],
|
||||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||||
shimmedLocationPath = './abc/../' + locationPath,
|
shimmedLocationPath = './abc/../' + locationPath,
|
||||||
underscoreLocationPath = './xyz/../' + locationPath,
|
underscoreLocationPath = './xyz/../' + locationPath,
|
||||||
uid = +new Date;
|
uid = +new Date;
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
var result = {
|
var result = {
|
||||||
'baseUrl': './',
|
'baseUrl': './',
|
||||||
'urlArgs': 't=' + uid++,
|
'urlArgs': 't=' + uid++,
|
||||||
'waitSeconds': 0,
|
'waitSeconds': 0,
|
||||||
'paths': {},
|
'paths': {},
|
||||||
'packages': [{
|
'packages': [{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'location': basePath + 'test',
|
'location': basePath + 'test',
|
||||||
'main': 'test',
|
'main': 'test',
|
||||||
'config': {
|
'config': {
|
||||||
// Work around no global being exported.
|
// Work around no global being exported.
|
||||||
'exports': 'QUnit',
|
'exports': 'QUnit',
|
||||||
'loader': 'curl/loader/legacy'
|
'loader': 'curl/loader/legacy'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
'shim': {
|
'shim': {
|
||||||
'shimmed': {
|
'shimmed': {
|
||||||
'exports': '_'
|
'exports': '_'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
result.packages.push({
|
result.packages.push({
|
||||||
'name': 'lodash',
|
'name': 'lodash',
|
||||||
'location': locationPath,
|
'location': locationPath,
|
||||||
'main': moduleMain
|
'main': moduleMain
|
||||||
}, {
|
}, {
|
||||||
'name': 'shimmed',
|
'name': 'shimmed',
|
||||||
'location': shimmedLocationPath,
|
'location': shimmedLocationPath,
|
||||||
'main': moduleMain
|
'main': moduleMain
|
||||||
}, {
|
}, {
|
||||||
'name': 'underscore',
|
'name': 'underscore',
|
||||||
'location': underscoreLocationPath,
|
'location': underscoreLocationPath,
|
||||||
'main': moduleMain
|
'main': moduleMain
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result.paths.lodash = modulePath;
|
result.paths.lodash = modulePath;
|
||||||
result.paths.shimmed = shimmedLocationPath + '/' + moduleMain;
|
result.paths.shimmed = shimmedLocationPath + '/' + moduleMain;
|
||||||
result.paths.underscore = underscoreLocationPath + '/' + moduleMain;
|
result.paths.underscore = underscoreLocationPath + '/' + moduleMain;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTests() {
|
function loadTests() {
|
||||||
require(getConfig(), ['test'], function() {
|
require(getConfig(), ['test'], function() {
|
||||||
QUnit.start();
|
QUnit.start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadModulesAndTests() {
|
function loadModulesAndTests() {
|
||||||
require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
require(getConfig(), ['lodash', 'shimmed', 'underscore'], function(lodash, shimmed, underscore) {
|
||||||
lodashModule = lodash;
|
lodashModule = lodash;
|
||||||
lodashModule.moduleName = 'lodash';
|
lodashModule.moduleName = 'lodash';
|
||||||
|
|
||||||
if (shimmed) {
|
if (shimmed) {
|
||||||
shimmedModule = shimmed.result(shimmed, 'noConflict') || shimmed;
|
shimmedModule = shimmed.result(shimmed, 'noConflict') || shimmed;
|
||||||
shimmedModule.moduleName = 'shimmed';
|
shimmedModule.moduleName = 'shimmed';
|
||||||
}
|
}
|
||||||
if (underscore) {
|
if (underscore) {
|
||||||
underscoreModule = underscore.result(underscore, 'noConflict') || underscore;
|
underscoreModule = underscore.result(underscore, 'noConflict') || underscore;
|
||||||
underscoreModule.moduleName = 'underscore';
|
underscoreModule.moduleName = 'underscore';
|
||||||
}
|
}
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
window._ = lodash;
|
window._ = lodash;
|
||||||
}
|
}
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
require(getConfig(), [
|
require(getConfig(), [
|
||||||
'lodash/internal/baseEach',
|
'lodash/internal/baseEach',
|
||||||
'lodash/internal/isIndex',
|
'lodash/internal/isIndex',
|
||||||
'lodash/internal/isIterateeCall',
|
'lodash/internal/isIterateeCall',
|
||||||
'lodash/internal/isLength'
|
'lodash/internal/isLength'
|
||||||
], function(baseEach, isIndex, isIterateeCall, isLength) {
|
], function(baseEach, isIndex, isIterateeCall, isLength) {
|
||||||
lodash._baseEach = baseEach;
|
lodash._baseEach = baseEach;
|
||||||
lodash._isIndex = isIndex;
|
lodash._isIndex = isIndex;
|
||||||
lodash._isIterateeCall = isIterateeCall;
|
lodash._isIterateeCall = isIterateeCall;
|
||||||
lodash._isLength = isLength;
|
lodash._isLength = isLength;
|
||||||
loadTests();
|
loadTests();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
loadTests();
|
loadTests();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|
||||||
if (window.requirejs) {
|
if (window.requirejs) {
|
||||||
addBizarroMethods();
|
addBizarroMethods();
|
||||||
require(getConfig(), ['lodash'], function(lodash) {
|
require(getConfig(), ['lodash'], function(lodash) {
|
||||||
lodashBizarro = lodash.result(lodash, 'noConflict') || lodash;
|
lodashBizarro = lodash.result(lodash, 'noConflict') || lodash;
|
||||||
delete requirejs.s.contexts._;
|
delete requirejs.s.contexts._;
|
||||||
|
|
||||||
removeBizarroMethods();
|
removeBizarroMethods();
|
||||||
loadModulesAndTests();
|
loadModulesAndTests();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
loadModulesAndTests();
|
loadModulesAndTests();
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// Set a more readable browser name.
|
// Set a more readable browser name.
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var timeoutId = setInterval(function() {
|
var timeoutId = setInterval(function() {
|
||||||
var ua = document.getElementById('qunit-userAgent');
|
var ua = document.getElementById('qunit-userAgent');
|
||||||
if (ua) {
|
if (ua) {
|
||||||
ua.innerHTML = platform;
|
ua.innerHTML = platform;
|
||||||
clearInterval(timeoutId);
|
clearInterval(timeoutId);
|
||||||
}
|
}
|
||||||
}, 16);
|
}, 16);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,242 +1,242 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Underscore Test Suite</title>
|
<title>Underscore Test Suite</title>
|
||||||
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="qunit"></div>
|
<div id="qunit"></div>
|
||||||
<script>
|
<script>
|
||||||
// Avoid reporting tests to Sauce Labs when script errors occur.
|
// Avoid reporting tests to Sauce Labs when script errors occur.
|
||||||
if (location.port == '9001') {
|
if (location.port == '9001') {
|
||||||
window.onerror = function(message) {
|
window.onerror = function(message) {
|
||||||
if (window.QUnit) {
|
if (window.QUnit) {
|
||||||
QUnit.config.done.length = 0;
|
QUnit.config.done.length = 0;
|
||||||
}
|
}
|
||||||
global_test_results = { 'message': message };
|
global_test_results = { 'message': message };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||||
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
<script src="../node_modules/qunit-extras/qunit-extras.js"></script>
|
||||||
<script src="../node_modules/jquery/dist/jquery.js"></script>
|
<script src="../node_modules/jquery/dist/jquery.js"></script>
|
||||||
<script src="../node_modules/platform/platform.js"></script>
|
<script src="../node_modules/platform/platform.js"></script>
|
||||||
<script src="./asset/test-ui.js"></script>
|
<script src="./asset/test-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
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.
|
// Excuse tests we intentionally fail or those with problems.
|
||||||
QUnit.config.excused = {
|
QUnit.config.excused = {
|
||||||
'Arrays': {
|
'Arrays': {
|
||||||
'drop': [
|
'drop': [
|
||||||
'alias for rest'
|
'alias for rest'
|
||||||
],
|
],
|
||||||
'first': [
|
'first': [
|
||||||
'can pass an index to first',
|
'can pass an index to first',
|
||||||
'[1,2]',
|
'[1,2]',
|
||||||
'0'
|
'0'
|
||||||
],
|
],
|
||||||
'flatten': [
|
'flatten': [
|
||||||
'Flattens empty arrays',
|
'Flattens empty arrays',
|
||||||
'can flatten nested arrays',
|
'can flatten nested arrays',
|
||||||
'can shallowly flatten nested arrays',
|
'can shallowly flatten nested arrays',
|
||||||
'works on an arguments object',
|
'works on an arguments object',
|
||||||
'can shallowly flatten arrays containing only other arrays'
|
'can shallowly flatten arrays containing only other arrays'
|
||||||
],
|
],
|
||||||
'initial': [
|
'initial': [
|
||||||
'initial can take an index',
|
'initial can take an index',
|
||||||
'initial can take a large index',
|
'initial can take a large index',
|
||||||
'initial works on arguments object'
|
'initial works on arguments object'
|
||||||
],
|
],
|
||||||
'intersection': [
|
'intersection': [
|
||||||
'can perform an OO-style intersection'
|
'can perform an OO-style intersection'
|
||||||
],
|
],
|
||||||
'last': [
|
'last': [
|
||||||
'can pass an index to last',
|
'can pass an index to last',
|
||||||
'0'
|
'0'
|
||||||
],
|
],
|
||||||
'lastIndexOf': [
|
'lastIndexOf': [
|
||||||
'[0,-1,-1]'
|
'[0,-1,-1]'
|
||||||
],
|
],
|
||||||
'rest': [
|
'rest': [
|
||||||
'working rest(0)',
|
'working rest(0)',
|
||||||
'rest can take an index',
|
'rest can take an index',
|
||||||
'works on arguments object'
|
'works on arguments object'
|
||||||
],
|
],
|
||||||
'take': [
|
'take': [
|
||||||
'alias for first'
|
'alias for first'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Chaining': {
|
'Chaining': {
|
||||||
'pop': true,
|
'pop': true,
|
||||||
'shift': true,
|
'shift': true,
|
||||||
'splice': true,
|
'splice': true,
|
||||||
'reverse/concat/unshift/pop/map': [
|
'reverse/concat/unshift/pop/map': [
|
||||||
'can chain together array functions.'
|
'can chain together array functions.'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Collections': {
|
'Collections': {
|
||||||
'filter': [
|
'filter': [
|
||||||
'OO-filter'
|
'OO-filter'
|
||||||
],
|
],
|
||||||
'invoke': [
|
'invoke': [
|
||||||
'handles null & undefined'
|
'handles null & undefined'
|
||||||
],
|
],
|
||||||
'map': [
|
'map': [
|
||||||
'OO-style doubled numbers'
|
'OO-style doubled numbers'
|
||||||
],
|
],
|
||||||
'Resistant to collection length and properties changing while iterating': [
|
'Resistant to collection length and properties changing while iterating': [
|
||||||
'Died on test #50'
|
'Died on test #50'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Functions': {
|
'Functions': {
|
||||||
'bind': [
|
'bind': [
|
||||||
'Died on test #2'
|
'Died on test #2'
|
||||||
],
|
],
|
||||||
'bindAll': [
|
'bindAll': [
|
||||||
'throws an error for bindAll with no functions named'
|
'throws an error for bindAll with no functions named'
|
||||||
],
|
],
|
||||||
'memoize': [
|
'memoize': [
|
||||||
'{"bar":"BAR","foo":"FOO"}',
|
'{"bar":"BAR","foo":"FOO"}',
|
||||||
'Died on test #8'
|
'Died on test #8'
|
||||||
],
|
],
|
||||||
'throttle repeatedly with results': true,
|
'throttle repeatedly with results': true,
|
||||||
'more throttle does not trigger leading call when leading is set to false': true,
|
'more throttle does not trigger leading call when leading is set to false': true,
|
||||||
'throttle does not trigger trailing call when trailing is set to false': true,
|
'throttle does not trigger trailing call when trailing is set to false': true,
|
||||||
'debounce asap': true
|
'debounce asap': true
|
||||||
},
|
},
|
||||||
'Objects': {
|
'Objects': {
|
||||||
'#1929 Typed Array constructors are functions': true,
|
'#1929 Typed Array constructors are functions': true,
|
||||||
'allKeys': true,
|
'allKeys': true,
|
||||||
'extendOwn': true,
|
'extendOwn': true,
|
||||||
'mapObject': true,
|
'mapObject': true,
|
||||||
'matcher': true,
|
'matcher': true,
|
||||||
'matcher ': true,
|
'matcher ': true,
|
||||||
'extend': [
|
'extend': [
|
||||||
'extend copies all properties from source'
|
'extend copies all properties from source'
|
||||||
],
|
],
|
||||||
'isEqual': [
|
'isEqual': [
|
||||||
'`0` is not equal to `-0`',
|
'`0` is not equal to `-0`',
|
||||||
'Commutative equality is implemented for `0` and `-0`',
|
'Commutative equality is implemented for `0` and `-0`',
|
||||||
'`new Number(0)` and `-0` are not equal',
|
'`new Number(0)` and `-0` are not equal',
|
||||||
'Commutative equality is implemented for `new Number(0)` and `-0`'
|
'Commutative equality is implemented for `new Number(0)` and `-0`'
|
||||||
],
|
],
|
||||||
'isFinite': [
|
'isFinite': [
|
||||||
'Numeric strings are numbers',
|
'Numeric strings are numbers',
|
||||||
'Number instances can be finite'
|
'Number instances can be finite'
|
||||||
],
|
],
|
||||||
'isMatch': [
|
'isMatch': [
|
||||||
'inherited and own properties are checked on the test object',
|
'inherited and own properties are checked on the test object',
|
||||||
'doesnt falsey match constructor on undefined/null'
|
'doesnt falsey match constructor on undefined/null'
|
||||||
],
|
],
|
||||||
'keys': [
|
'keys': [
|
||||||
'is not fooled by sparse arrays; see issue #95',
|
'is not fooled by sparse arrays; see issue #95',
|
||||||
'[]'
|
'[]'
|
||||||
],
|
],
|
||||||
'matches': [
|
'matches': [
|
||||||
'inherited and own properties are checked on the test object',
|
'inherited and own properties are checked on the test object',
|
||||||
'doesnt fasley match constructor on undefined/null'
|
'doesnt fasley match constructor on undefined/null'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'Utility': {
|
'Utility': {
|
||||||
'now': [
|
'now': [
|
||||||
'Produces the correct time in milliseconds'
|
'Produces the correct time in milliseconds'
|
||||||
],
|
],
|
||||||
'times': [
|
'times': [
|
||||||
'works as a wrapper'
|
'works as a wrapper'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only excuse in Sauce Labs (buggy Safari and timers).
|
// Only excuse in Sauce Labs (buggy Safari and timers).
|
||||||
if (!ui.isSauceLabs) {
|
if (!ui.isSauceLabs) {
|
||||||
delete QUnit.config.excused.Functions['throttle repeatedly with results'];
|
delete QUnit.config.excused.Functions['throttle repeatedly with results'];
|
||||||
delete QUnit.config.excused.Functions['more throttle does not trigger leading call when leading is set to false'];
|
delete QUnit.config.excused.Functions['more throttle does not trigger leading call when leading is set to false'];
|
||||||
delete QUnit.config.excused.Functions['throttle does not trigger trailing call when trailing is set to false'];
|
delete QUnit.config.excused.Functions['throttle does not trigger trailing call when trailing is set to false'];
|
||||||
delete QUnit.config.excused.Functions['debounce asap'];
|
delete QUnit.config.excused.Functions['debounce asap'];
|
||||||
delete QUnit.config.excused.Utility.now;
|
delete QUnit.config.excused.Utility.now;
|
||||||
}
|
}
|
||||||
// Load 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>'
|
||||||
: ([
|
: ([
|
||||||
'<script src="' + ui.buildPath + '"><\/script>',
|
'<script src="' + ui.buildPath + '"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/collections.js"><\/script>',
|
'<script src="../vendor/underscore/test/collections.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/arrays.js"><\/script>',
|
'<script src="../vendor/underscore/test/arrays.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/functions.js"><\/script>',
|
'<script src="../vendor/underscore/test/functions.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/objects.js"><\/script>',
|
'<script src="../vendor/underscore/test/objects.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/cross-document.js"><\/script>',
|
'<script src="../vendor/underscore/test/cross-document.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/utility.js"><\/script>',
|
'<script src="../vendor/underscore/test/utility.js"><\/script>',
|
||||||
'<script src="../vendor/underscore/test/chaining.js"><\/script>'
|
'<script src="../vendor/underscore/test/chaining.js"><\/script>'
|
||||||
].join('\n'))
|
].join('\n'))
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
if (window.curl) {
|
if (window.curl) {
|
||||||
curl.config({ 'apiName': 'require' });
|
curl.config({ 'apiName': 'require' });
|
||||||
}
|
}
|
||||||
if (!window.require) {
|
if (!window.require) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var reBasename = /[\w.-]+$/,
|
var reBasename = /[\w.-]+$/,
|
||||||
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
|
||||||
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
modulePath = ui.buildPath.replace(/\.js$/, ''),
|
||||||
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
|
||||||
moduleId = /\bunderscore\b/i.test(ui.buildPath) ? 'underscore' : 'lodash',
|
moduleId = /\bunderscore\b/i.test(ui.buildPath) ? 'underscore' : 'lodash',
|
||||||
moduleMain = modulePath.match(reBasename)[0],
|
moduleMain = modulePath.match(reBasename)[0],
|
||||||
uid = +new Date;
|
uid = +new Date;
|
||||||
|
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
var result = {
|
var result = {
|
||||||
'baseUrl': './',
|
'baseUrl': './',
|
||||||
'urlArgs': 't=' + uid++,
|
'urlArgs': 't=' + uid++,
|
||||||
'waitSeconds': 0,
|
'waitSeconds': 0,
|
||||||
'paths': {},
|
'paths': {},
|
||||||
'packages': [{
|
'packages': [{
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'location': '../vendor/underscore/test',
|
'location': '../vendor/underscore/test',
|
||||||
'config': {
|
'config': {
|
||||||
// Work around no global being exported.
|
// Work around no global being exported.
|
||||||
'exports': 'QUnit',
|
'exports': 'QUnit',
|
||||||
'loader': 'curl/loader/legacy'
|
'loader': 'curl/loader/legacy'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
result.packages.push({
|
result.packages.push({
|
||||||
'name': moduleId,
|
'name': moduleId,
|
||||||
'location': locationPath,
|
'location': locationPath,
|
||||||
'main': moduleMain
|
'main': moduleMain
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
result.paths[moduleId] = modulePath;
|
result.paths[moduleId] = modulePath;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
|
|
||||||
require(getConfig(), [moduleId], function(lodash) {
|
require(getConfig(), [moduleId], function(lodash) {
|
||||||
if (ui.isModularize) {
|
if (ui.isModularize) {
|
||||||
window._ = lodash;
|
window._ = lodash;
|
||||||
}
|
}
|
||||||
require(getConfig(), [
|
require(getConfig(), [
|
||||||
'test/collections',
|
'test/collections',
|
||||||
'test/arrays',
|
'test/arrays',
|
||||||
'test/functions',
|
'test/functions',
|
||||||
'test/objects',
|
'test/objects',
|
||||||
'test/cross-document',
|
'test/cross-document',
|
||||||
'test/utility',
|
'test/utility',
|
||||||
'test/chaining'
|
'test/chaining'
|
||||||
], function() {
|
], function() {
|
||||||
QUnit.start();
|
QUnit.start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user