mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Meta: update dependencies
This commit is contained in:
parent
ae9cd4b0a1
commit
2a96ed7c1d
@ -58,7 +58,7 @@
|
|||||||
"grunt-contrib-clean": "^1.1.0",
|
"grunt-contrib-clean": "^1.1.0",
|
||||||
"grunt-contrib-concat": "^1.0.1",
|
"grunt-contrib-concat": "^1.0.1",
|
||||||
"grunt-contrib-copy": "^1.0.0",
|
"grunt-contrib-copy": "^1.0.0",
|
||||||
"grunt-contrib-cssmin": "^2.2.0",
|
"grunt-contrib-cssmin": "^2.2.1",
|
||||||
"grunt-contrib-jshint": "^1.1.0",
|
"grunt-contrib-jshint": "^1.1.0",
|
||||||
"grunt-contrib-qunit": "^2.0.0",
|
"grunt-contrib-qunit": "^2.0.0",
|
||||||
"grunt-contrib-uglify": "^3.0.1",
|
"grunt-contrib-uglify": "^3.0.1",
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Tablesorter Testing (WIP)</title>
|
<title>Tablesorter Testing (WIP)</title>
|
||||||
<link rel="stylesheet" href="testing/qunit-2.3.1.css">
|
<link rel="stylesheet" href="testing/qunit-2.4.0.css">
|
||||||
<link rel="stylesheet" href="testing/testing.css">
|
<link rel="stylesheet" href="testing/testing.css">
|
||||||
|
|
||||||
<script src="testing/qunit-2.3.1.js"></script>
|
<script src="testing/qunit-2.4.0.js"></script>
|
||||||
<script src="docs/js/jquery-latest.min.js"></script>
|
<script src="docs/js/jquery-latest.min.js"></script>
|
||||||
<script src="js/jquery.tablesorter.js"></script>
|
<script src="js/jquery.tablesorter.js"></script>
|
||||||
<script src="js/widgets/widget-filter.js"></script>
|
<script src="js/widgets/widget-filter.js"></script>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/*!
|
/*!
|
||||||
* QUnit 2.3.1
|
* QUnit 2.4.0
|
||||||
* https://qunitjs.com/
|
* https://qunitjs.com/
|
||||||
*
|
*
|
||||||
* Copyright jQuery Foundation and other contributors
|
* Copyright jQuery Foundation and other contributors
|
||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
* https://jquery.org/license
|
* https://jquery.org/license
|
||||||
*
|
*
|
||||||
* Date: 2017-04-10T19:56Z
|
* Date: 2017-07-08T15:20Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Font Family and Sizes */
|
/** Font Family and Sizes */
|
@ -1,19 +1,20 @@
|
|||||||
/*!
|
/*!
|
||||||
* QUnit 2.3.1
|
* QUnit 2.4.0
|
||||||
* https://qunitjs.com/
|
* https://qunitjs.com/
|
||||||
*
|
*
|
||||||
* Copyright jQuery Foundation and other contributors
|
* Copyright jQuery Foundation and other contributors
|
||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
* https://jquery.org/license
|
* https://jquery.org/license
|
||||||
*
|
*
|
||||||
* Date: 2017-04-10T19:56Z
|
* Date: 2017-07-08T15:20Z
|
||||||
*/
|
*/
|
||||||
(function (global$1) {
|
(function (global$1) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
global$1 = 'default' in global$1 ? global$1['default'] : global$1;
|
global$1 = global$1 && 'default' in global$1 ? global$1['default'] : global$1;
|
||||||
|
|
||||||
var window = global$1.window;
|
var window = global$1.window;
|
||||||
|
var self$1 = global$1.self;
|
||||||
var console = global$1.console;
|
var console = global$1.console;
|
||||||
var setTimeout = global$1.setTimeout;
|
var setTimeout = global$1.setTimeout;
|
||||||
var clearTimeout = global$1.clearTimeout;
|
var clearTimeout = global$1.clearTimeout;
|
||||||
@ -226,10 +227,8 @@
|
|||||||
case "Function":
|
case "Function":
|
||||||
case "Symbol":
|
case "Symbol":
|
||||||
return type.toLowerCase();
|
return type.toLowerCase();
|
||||||
}
|
default:
|
||||||
|
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
|
||||||
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object") {
|
|
||||||
return "object";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +586,13 @@
|
|||||||
return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1));
|
return arguments.length === 2 || innerEquiv.apply(this, [].slice.call(arguments, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return innerEquiv;
|
return function () {
|
||||||
|
var result = innerEquiv.apply(undefined, arguments);
|
||||||
|
|
||||||
|
// Release any retained objects
|
||||||
|
pairs.length = 0;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -634,7 +639,14 @@
|
|||||||
name: "",
|
name: "",
|
||||||
tests: [],
|
tests: [],
|
||||||
childModules: [],
|
childModules: [],
|
||||||
testsRun: 0
|
testsRun: 0,
|
||||||
|
unskippedTestsRun: 0,
|
||||||
|
hooks: {
|
||||||
|
before: [],
|
||||||
|
beforeEach: [],
|
||||||
|
afterEach: [],
|
||||||
|
after: []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
callbacks: {},
|
callbacks: {},
|
||||||
@ -1315,7 +1327,7 @@
|
|||||||
return TestReport;
|
return TestReport;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
var focused = false;
|
var focused$1 = false;
|
||||||
|
|
||||||
function Test(settings) {
|
function Test(settings) {
|
||||||
var i, l;
|
var i, l;
|
||||||
@ -1323,12 +1335,30 @@
|
|||||||
++Test.count;
|
++Test.count;
|
||||||
|
|
||||||
this.expected = null;
|
this.expected = null;
|
||||||
extend(this, settings);
|
|
||||||
this.assertions = [];
|
this.assertions = [];
|
||||||
this.semaphore = 0;
|
this.semaphore = 0;
|
||||||
this.module = config.currentModule;
|
this.module = config.currentModule;
|
||||||
this.stack = sourceFromStacktrace(3);
|
this.stack = sourceFromStacktrace(3);
|
||||||
this.steps = [];
|
this.steps = [];
|
||||||
|
this.timeout = undefined;
|
||||||
|
|
||||||
|
// If a module is skipped, all its tests and the tests of the child suites
|
||||||
|
// should be treated as skipped even if they are defined as `only` or `todo`.
|
||||||
|
// As for `todo` module, all its tests will be treated as `todo` except for
|
||||||
|
// tests defined as `skip` which will be left intact.
|
||||||
|
//
|
||||||
|
// So, if a test is defined as `todo` and is inside a skipped module, we should
|
||||||
|
// then treat that test as if was defined as `skip`.
|
||||||
|
if (this.module.skip) {
|
||||||
|
settings.skip = true;
|
||||||
|
settings.todo = false;
|
||||||
|
|
||||||
|
// Skipped tests should be left intact
|
||||||
|
} else if (this.module.todo && !settings.skip) {
|
||||||
|
settings.todo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend(this, settings);
|
||||||
|
|
||||||
this.testReport = new TestReport(settings.testName, this.module.suiteReport, {
|
this.testReport = new TestReport(settings.testName, this.module.suiteReport, {
|
||||||
todo: settings.todo,
|
todo: settings.todo,
|
||||||
@ -1347,7 +1377,8 @@
|
|||||||
|
|
||||||
this.module.tests.push({
|
this.module.tests.push({
|
||||||
name: this.testName,
|
name: this.testName,
|
||||||
testId: this.testId
|
testId: this.testId,
|
||||||
|
skip: !!settings.skip
|
||||||
});
|
});
|
||||||
|
|
||||||
if (settings.skip) {
|
if (settings.skip) {
|
||||||
@ -1439,6 +1470,12 @@
|
|||||||
function runTest(test) {
|
function runTest(test) {
|
||||||
promise = test.callback.call(test.testEnvironment, test.assert);
|
promise = test.callback.call(test.testEnvironment, test.assert);
|
||||||
test.resolvePromise(promise);
|
test.resolvePromise(promise);
|
||||||
|
|
||||||
|
// If the test has a "lock" on it, but the timeout is 0, then we push a
|
||||||
|
// failure as the test should be synchronous.
|
||||||
|
if (test.timeout === 0 && test.semaphore !== 0) {
|
||||||
|
pushFailure("Test did not finish synchronously even though assert.timeout( 0 ) was used.", sourceFromStacktrace(2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1447,22 +1484,27 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
queueHook: function queueHook(hook, hookName, hookOwner) {
|
queueHook: function queueHook(hook, hookName, hookOwner) {
|
||||||
var promise,
|
var _this = this;
|
||||||
test = this;
|
|
||||||
return function runHook() {
|
var callHook = function callHook() {
|
||||||
|
var promise = hook.call(_this.testEnvironment, _this.assert);
|
||||||
|
_this.resolvePromise(promise, hookName);
|
||||||
|
};
|
||||||
|
|
||||||
|
var runHook = function runHook() {
|
||||||
if (hookName === "before") {
|
if (hookName === "before") {
|
||||||
if (hookOwner.testsRun !== 0) {
|
if (hookOwner.unskippedTestsRun !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
test.preserveEnvironment = true;
|
_this.preserveEnvironment = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hookName === "after" && hookOwner.testsRun !== numberOfTests(hookOwner) - 1 && config.queue.length > 2) {
|
if (hookName === "after" && hookOwner.unskippedTestsRun !== numberOfUnskippedTests(hookOwner) - 1 && config.queue.length > 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.current = test;
|
config.current = _this;
|
||||||
if (config.notrycatch) {
|
if (config.notrycatch) {
|
||||||
callHook();
|
callHook();
|
||||||
return;
|
return;
|
||||||
@ -1470,16 +1512,14 @@
|
|||||||
try {
|
try {
|
||||||
callHook();
|
callHook();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
test.pushFailure(hookName + " failed on " + test.testName + ": " + (error.message || error), extractStacktrace(error, 0));
|
_this.pushFailure(hookName + " failed on " + _this.testName + ": " + (error.message || error), extractStacktrace(error, 0));
|
||||||
}
|
|
||||||
|
|
||||||
function callHook() {
|
|
||||||
promise = hook.call(test.testEnvironment, test.assert);
|
|
||||||
test.resolvePromise(promise, hookName);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return runHook;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// Currently only used for module level hooks, can be used to add global level ones
|
// Currently only used for module level hooks, can be used to add global level ones
|
||||||
hooks: function hooks(handler) {
|
hooks: function hooks(handler) {
|
||||||
var hooks = [];
|
var hooks = [];
|
||||||
@ -1488,8 +1528,11 @@
|
|||||||
if (module.parentModule) {
|
if (module.parentModule) {
|
||||||
processHooks(test, module.parentModule);
|
processHooks(test, module.parentModule);
|
||||||
}
|
}
|
||||||
if (module.hooks && objectType(module.hooks[handler]) === "function") {
|
|
||||||
hooks.push(test.queueHook(module.hooks[handler], handler, module));
|
if (module.hooks[handler].length) {
|
||||||
|
for (var i = 0; i < module.hooks[handler].length; i++) {
|
||||||
|
hooks.push(test.queueHook(module.hooks[handler][i], handler, module));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,9 +1540,11 @@
|
|||||||
if (!this.skip) {
|
if (!this.skip) {
|
||||||
processHooks(this, this.module);
|
processHooks(this, this.module);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hooks;
|
return hooks;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
finish: function finish() {
|
finish: function finish() {
|
||||||
config.current = this;
|
config.current = this;
|
||||||
if (config.requireExpects && this.expected === null) {
|
if (config.requireExpects && this.expected === null) {
|
||||||
@ -1532,7 +1577,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyTestsRan(module);
|
notifyTestsRan(module, skipped);
|
||||||
|
|
||||||
// Store result when possible
|
// Store result when possible
|
||||||
if (storage) {
|
if (storage) {
|
||||||
@ -1857,7 +1902,7 @@
|
|||||||
|
|
||||||
// Will be exposed as QUnit.test
|
// Will be exposed as QUnit.test
|
||||||
function test(testName, callback) {
|
function test(testName, callback) {
|
||||||
if (focused) {
|
if (focused$1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1870,7 +1915,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function todo(testName, callback) {
|
function todo(testName, callback) {
|
||||||
if (focused) {
|
if (focused$1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1885,7 +1930,7 @@
|
|||||||
|
|
||||||
// Will be exposed as QUnit.skip
|
// Will be exposed as QUnit.skip
|
||||||
function skip(testName) {
|
function skip(testName) {
|
||||||
if (focused) {
|
if (focused$1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,12 +1944,12 @@
|
|||||||
|
|
||||||
// Will be exposed as QUnit.only
|
// Will be exposed as QUnit.only
|
||||||
function only(testName, callback) {
|
function only(testName, callback) {
|
||||||
if (focused) {
|
if (focused$1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.queue.length = 0;
|
config.queue.length = 0;
|
||||||
focused = true;
|
focused$1 = true;
|
||||||
|
|
||||||
var newTest = new Test({
|
var newTest = new Test({
|
||||||
testName: testName,
|
testName: testName,
|
||||||
@ -1916,20 +1961,29 @@
|
|||||||
|
|
||||||
// Put a hold on processing and return a function that will release it.
|
// Put a hold on processing and return a function that will release it.
|
||||||
function internalStop(test) {
|
function internalStop(test) {
|
||||||
var released = false;
|
|
||||||
|
|
||||||
test.semaphore += 1;
|
test.semaphore += 1;
|
||||||
config.blocking = true;
|
config.blocking = true;
|
||||||
|
|
||||||
// Set a recovery timeout, if so configured.
|
// Set a recovery timeout, if so configured.
|
||||||
if (config.testTimeout && defined.setTimeout) {
|
if (defined.setTimeout) {
|
||||||
clearTimeout(config.timeout);
|
var timeoutDuration = void 0;
|
||||||
config.timeout = setTimeout(function () {
|
|
||||||
pushFailure("Test timed out", sourceFromStacktrace(2));
|
if (typeof test.timeout === "number") {
|
||||||
internalRecover(test);
|
timeoutDuration = test.timeout;
|
||||||
}, config.testTimeout);
|
} else if (typeof config.testTimeout === "number") {
|
||||||
|
timeoutDuration = config.testTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof timeoutDuration === "number" && timeoutDuration > 0) {
|
||||||
|
clearTimeout(config.timeout);
|
||||||
|
config.timeout = setTimeout(function () {
|
||||||
|
pushFailure("Test took longer than " + timeoutDuration + "ms; test timed out.", sourceFromStacktrace(2));
|
||||||
|
internalRecover(test);
|
||||||
|
}, timeoutDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var released = false;
|
||||||
return function resume() {
|
return function resume() {
|
||||||
if (released) {
|
if (released) {
|
||||||
return;
|
return;
|
||||||
@ -1992,24 +2046,40 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function numberOfTests(module) {
|
function collectTests(module) {
|
||||||
var count = module.tests.length;
|
var tests = [].concat(module.tests);
|
||||||
var modules = [].concat(toConsumableArray(module.childModules));
|
var modules = [].concat(toConsumableArray(module.childModules));
|
||||||
|
|
||||||
// Do a breadth-first traversal of the child modules
|
// Do a breadth-first traversal of the child modules
|
||||||
while (modules.length) {
|
while (modules.length) {
|
||||||
var nextModule = modules.shift();
|
var nextModule = modules.shift();
|
||||||
count += nextModule.tests.length;
|
tests.push.apply(tests, nextModule.tests);
|
||||||
modules.push.apply(modules, toConsumableArray(nextModule.childModules));
|
modules.push.apply(modules, toConsumableArray(nextModule.childModules));
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyTestsRan(module) {
|
function numberOfTests(module) {
|
||||||
|
return collectTests(module).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberOfUnskippedTests(module) {
|
||||||
|
return collectTests(module).filter(function (test) {
|
||||||
|
return !test.skip;
|
||||||
|
}).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyTestsRan(module, skipped) {
|
||||||
module.testsRun++;
|
module.testsRun++;
|
||||||
|
if (!skipped) {
|
||||||
|
module.unskippedTestsRun++;
|
||||||
|
}
|
||||||
while (module = module.parentModule) {
|
while (module = module.parentModule) {
|
||||||
module.testsRun++;
|
module.testsRun++;
|
||||||
|
if (!skipped) {
|
||||||
|
module.unskippedTestsRun++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2040,10 +2110,19 @@
|
|||||||
|
|
||||||
// Assert helpers
|
// Assert helpers
|
||||||
|
|
||||||
|
createClass(Assert, [{
|
||||||
|
key: "timeout",
|
||||||
|
value: function timeout(duration) {
|
||||||
|
if (typeof duration !== "number") {
|
||||||
|
throw new Error("You must pass a number as the duration to assert.timeout");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.test.timeout = duration;
|
||||||
|
}
|
||||||
|
|
||||||
// Documents a "step", which is a string value, in a test as a passing assertion
|
// Documents a "step", which is a string value, in a test as a passing assertion
|
||||||
|
|
||||||
|
}, {
|
||||||
createClass(Assert, [{
|
|
||||||
key: "step",
|
key: "step",
|
||||||
value: function step(message) {
|
value: function step(message) {
|
||||||
var result = !!message;
|
var result = !!message;
|
||||||
@ -2119,7 +2198,7 @@
|
|||||||
}, {
|
}, {
|
||||||
key: "push",
|
key: "push",
|
||||||
value: function push(result, actual, expected, message, negative) {
|
value: function push(result, actual, expected, message, negative) {
|
||||||
Logger.warn("assert.push is deprecated and will be removed in QUnit 3.0." + " Please use assert.pushResult instead (http://api.qunitjs.com/pushResult/).");
|
Logger.warn("assert.push is deprecated and will be removed in QUnit 3.0." + " Please use assert.pushResult instead (https://api.qunitjs.com/assert/pushResult).");
|
||||||
|
|
||||||
var currentAssert = this instanceof Assert ? this : config.current.assert;
|
var currentAssert = this instanceof Assert ? this : config.current.assert;
|
||||||
return currentAssert.pushResult({
|
return currentAssert.pushResult({
|
||||||
@ -2409,6 +2488,11 @@
|
|||||||
});
|
});
|
||||||
QUnit.config.autostart = false;
|
QUnit.config.autostart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Web/Service Workers
|
||||||
|
if (self$1 && self$1.WorkerGlobalScope && self$1 instanceof self$1.WorkerGlobalScope) {
|
||||||
|
self$1.QUnit = QUnit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var SuiteReport = function () {
|
var SuiteReport = function () {
|
||||||
@ -2549,6 +2633,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var focused = false;
|
||||||
var QUnit = {};
|
var QUnit = {};
|
||||||
var globalSuite = new SuiteReport();
|
var globalSuite = new SuiteReport();
|
||||||
|
|
||||||
@ -2565,21 +2650,32 @@
|
|||||||
QUnit.isLocal = !(defined.document && window.location.protocol !== "file:");
|
QUnit.isLocal = !(defined.document && window.location.protocol !== "file:");
|
||||||
|
|
||||||
// Expose the current QUnit version
|
// Expose the current QUnit version
|
||||||
QUnit.version = "2.3.1";
|
QUnit.version = "2.4.0";
|
||||||
|
|
||||||
function createModule(name, testEnvironment) {
|
function createModule(name, testEnvironment, modifiers) {
|
||||||
var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null;
|
var parentModule = moduleStack.length ? moduleStack.slice(-1)[0] : null;
|
||||||
var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name;
|
var moduleName = parentModule !== null ? [parentModule.name, name].join(" > ") : name;
|
||||||
var parentSuite = parentModule ? parentModule.suiteReport : globalSuite;
|
var parentSuite = parentModule ? parentModule.suiteReport : globalSuite;
|
||||||
|
|
||||||
|
var skip$$1 = parentModule !== null && parentModule.skip || modifiers.skip;
|
||||||
|
var todo$$1 = parentModule !== null && parentModule.todo || modifiers.todo;
|
||||||
|
|
||||||
var module = {
|
var module = {
|
||||||
name: moduleName,
|
name: moduleName,
|
||||||
parentModule: parentModule,
|
parentModule: parentModule,
|
||||||
tests: [],
|
tests: [],
|
||||||
moduleId: generateHash(moduleName),
|
moduleId: generateHash(moduleName),
|
||||||
testsRun: 0,
|
testsRun: 0,
|
||||||
|
unskippedTestsRun: 0,
|
||||||
childModules: [],
|
childModules: [],
|
||||||
suiteReport: new SuiteReport(name, parentSuite)
|
suiteReport: new SuiteReport(name, parentSuite),
|
||||||
|
|
||||||
|
// Pass along `skip` and `todo` properties from parent module, in case
|
||||||
|
// there is one, to childs. And use own otherwise.
|
||||||
|
// This property will be used to mark own tests and tests of child suites
|
||||||
|
// as either `skipped` or `todo`.
|
||||||
|
skip: skip$$1,
|
||||||
|
todo: skip$$1 ? false : todo$$1
|
||||||
};
|
};
|
||||||
|
|
||||||
var env = {};
|
var env = {};
|
||||||
@ -2594,40 +2690,31 @@
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
extend(QUnit, {
|
function processModule(name, options, executeNow) {
|
||||||
on: on,
|
var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||||
|
|
||||||
// Call on start of module test to prepend name to all tests
|
var module = createModule(name, options, modifiers);
|
||||||
module: function module(name, testEnvironment, executeNow) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
if (objectType(testEnvironment) === "function") {
|
|
||||||
executeNow = testEnvironment;
|
|
||||||
testEnvironment = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var module = createModule(name, testEnvironment);
|
|
||||||
|
|
||||||
// Move any hooks to a 'hooks' object
|
// Move any hooks to a 'hooks' object
|
||||||
if (module.testEnvironment) {
|
var testEnvironment = module.testEnvironment;
|
||||||
module.hooks = {
|
var hooks = module.hooks = {};
|
||||||
before: module.testEnvironment.before,
|
|
||||||
beforeEach: module.testEnvironment.beforeEach,
|
|
||||||
afterEach: module.testEnvironment.afterEach,
|
|
||||||
after: module.testEnvironment.after
|
|
||||||
};
|
|
||||||
|
|
||||||
delete module.testEnvironment.before;
|
setHookFromEnvironment(hooks, testEnvironment, "before");
|
||||||
delete module.testEnvironment.beforeEach;
|
setHookFromEnvironment(hooks, testEnvironment, "beforeEach");
|
||||||
delete module.testEnvironment.afterEach;
|
setHookFromEnvironment(hooks, testEnvironment, "afterEach");
|
||||||
delete module.testEnvironment.after;
|
setHookFromEnvironment(hooks, testEnvironment, "after");
|
||||||
|
|
||||||
|
function setHookFromEnvironment(hooks, environment, name) {
|
||||||
|
var potentialHook = environment[name];
|
||||||
|
hooks[name] = typeof potentialHook === "function" ? [potentialHook] : [];
|
||||||
|
delete environment[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
var moduleFns = {
|
var moduleFns = {
|
||||||
before: setHook(module, "before"),
|
before: setHookFunction(module, "before"),
|
||||||
beforeEach: setHook(module, "beforeEach"),
|
beforeEach: setHookFunction(module, "beforeEach"),
|
||||||
afterEach: setHook(module, "afterEach"),
|
afterEach: setHookFunction(module, "afterEach"),
|
||||||
after: setHook(module, "after")
|
after: setHookFunction(module, "after")
|
||||||
};
|
};
|
||||||
|
|
||||||
var currentModule = config.currentModule;
|
var currentModule = config.currentModule;
|
||||||
@ -2640,7 +2727,71 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.currentModule = module;
|
config.currentModule = module;
|
||||||
},
|
}
|
||||||
|
|
||||||
|
// TODO: extract this to a new file alongside its related functions
|
||||||
|
function module$1(name, options, executeNow) {
|
||||||
|
if (focused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments.length === 2) {
|
||||||
|
if (objectType(options) === "function") {
|
||||||
|
executeNow = options;
|
||||||
|
options = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processModule(name, options, executeNow);
|
||||||
|
}
|
||||||
|
|
||||||
|
module$1.only = function () {
|
||||||
|
if (focused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.modules.length = 0;
|
||||||
|
config.queue.length = 0;
|
||||||
|
|
||||||
|
module$1.apply(undefined, arguments);
|
||||||
|
|
||||||
|
focused = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
module$1.skip = function (name, options, executeNow) {
|
||||||
|
if (focused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments.length === 2) {
|
||||||
|
if (objectType(options) === "function") {
|
||||||
|
executeNow = options;
|
||||||
|
options = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processModule(name, options, executeNow, { skip: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
module$1.todo = function (name, options, executeNow) {
|
||||||
|
if (focused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arguments.length === 2) {
|
||||||
|
if (objectType(options) === "function") {
|
||||||
|
executeNow = options;
|
||||||
|
options = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processModule(name, options, executeNow, { todo: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
extend(QUnit, {
|
||||||
|
on: on,
|
||||||
|
|
||||||
|
module: module$1,
|
||||||
|
|
||||||
test: test,
|
test: test,
|
||||||
|
|
||||||
@ -2777,13 +2928,9 @@
|
|||||||
ProcessingQueue.advance();
|
ProcessingQueue.advance();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHook(module, hookName) {
|
function setHookFunction(module, hookName) {
|
||||||
if (!module.hooks) {
|
return function setHook(callback) {
|
||||||
module.hooks = {};
|
module.hooks[hookName].push(callback);
|
||||||
}
|
|
||||||
|
|
||||||
return function (callback) {
|
|
||||||
module.hooks[hookName] = callback;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3641,13 +3788,19 @@
|
|||||||
|
|
||||||
message += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText(actual) + "</pre></td></tr>";
|
message += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText(actual) + "</pre></td></tr>";
|
||||||
|
|
||||||
// Don't show diff if actual or expected are booleans
|
if (typeof details.actual === "number" && typeof details.expected === "number") {
|
||||||
if (!/^(true|false)$/.test(actual) && !/^(true|false)$/.test(expected)) {
|
if (!isNaN(details.actual) && !isNaN(details.expected)) {
|
||||||
|
showDiff = true;
|
||||||
|
diff = details.actual - details.expected;
|
||||||
|
diff = (diff > 0 ? "+" : "") + diff;
|
||||||
|
}
|
||||||
|
} else if (typeof details.actual !== "boolean" && typeof details.expected !== "boolean") {
|
||||||
diff = QUnit.diff(expected, actual);
|
diff = QUnit.diff(expected, actual);
|
||||||
|
|
||||||
|
// don't show diff if there is zero overlap
|
||||||
showDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length;
|
showDiff = stripHtml(diff).length !== stripHtml(expected).length + stripHtml(actual).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't show diff if expected and actual are totally different
|
|
||||||
if (showDiff) {
|
if (showDiff) {
|
||||||
message += "<tr class='test-diff'><th>Diff: </th><td><pre>" + diff + "</pre></td></tr>";
|
message += "<tr class='test-diff'><th>Diff: </th><td><pre>" + diff + "</pre></td></tr>";
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user