(http://allyoucanleet.com/)",
diff --git a/test/test-ui.js b/test/test-ui.js
index 81d90b3386..06ff770222 100644
--- a/test/test-ui.js
+++ b/test/test-ui.js
@@ -49,7 +49,6 @@
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break;
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
- case 'lodash-modularize': result = 'modularize/main.js'; break;
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
@@ -74,7 +73,7 @@
}());
// used to indicate testing a modularized build
- ui.isModularize = /\b(?:lodash-(?:amd|node)|modularize)\b/.test([location.pathname, location.search, ui.buildPath]);
+ ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize)\b/.test([location.pathname, location.search, ui.buildPath]);
// initialize controls
addListener(window, 'load', function() {
@@ -108,10 +107,9 @@
case 'lodash-modern': return 3;
case 'lodash-legacy': return 4;
case 'lodash-mobile': return 5;
- case 'lodash-modularize': return 6;
- case 'lodash-underscore': return 7;
- case 'lodash-custom-dev': return 8;
- case 'lodash-custom': return 9;
+ case 'lodash-underscore': return 6;
+ case 'lodash-custom-dev': return 7;
+ case 'lodash-custom': return 8;
case 'lodash-compat-dev':
case null: return 0;
}
@@ -148,7 +146,6 @@
'' +
'' +
'' +
- '' +
'' +
'' +
'' +
diff --git a/test/test.js b/test/test.js
index 9753514e8c..d38f8acca8 100644
--- a/test/test.js
+++ b/test/test.js
@@ -36,6 +36,9 @@
return result;
}());
+ /** The basename of the Lo-Dash file to test */
+ var basename = /[\w.-]+$/.exec(filePath)[0];
+
/** The `ui` object */
var ui = root.ui || (root.ui = {
'buildPath': filePath,
@@ -44,7 +47,7 @@
});
/** Used to indicate testing a modularized build */
- var isModularize = ui.isModularize || /\b(?:lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build]);
+ var isModularize = ui.isModularize || /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build, basename]);
/*--------------------------------------------------------------------------*/
@@ -101,12 +104,12 @@
/** Detects if running in a PhantomJS web page */
var isPhantomPage = typeof callPhantom == 'function';
+ /** Detect if running in Rhino */
+ var isRhino = root.java && typeof global == 'function' && global().Array === root.Array;
+
/** Use a single "load" function */
var load = !amd && typeof require == 'function' ? require : root.load;
- /** The basename of the Lo-Dash file to test */
- var basename = /[\w.-]+$/.exec(filePath)[0];
-
/** The unit testing framework */
var QUnit = (function() {
var noop = Function.prototype;
@@ -208,7 +211,7 @@
QUnit.module(basename);
(function() {
- test('supports loading ' + basename + ' as the "lodash" module', function() {
+ test('supports loading ' + basename + ' as the "lodash" module', 1, function() {
if (amd) {
equal((lodashModule || {}).moduleName, 'lodash');
} else {
@@ -216,7 +219,7 @@
}
});
- test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() {
+ test('supports loading ' + basename + ' with the Require.js "shim" configuration option', 1, function() {
if (amd && /requirejs/.test(ui.loaderPath)) {
equal((shimmedModule || {}).moduleName, 'shimmed');
} else {
@@ -224,7 +227,7 @@
}
});
- test('supports loading ' + basename + ' as the "underscore" module', function() {
+ test('supports loading ' + basename + ' as the "underscore" module', 1, function() {
if (amd && !/dojo/.test(ui.loaderPath)) {
equal((underscoreModule || {}).moduleName, 'underscore');
} else {
@@ -232,7 +235,7 @@
}
});
- asyncTest('supports loading ' + basename + ' in a web worker', function() {
+ asyncTest('supports loading ' + basename + ' in a web worker', 1, function() {
if (Worker && !isModularize) {
var limit = 1000,
start = new Date;
@@ -248,13 +251,14 @@
};
attempt();
- } else {
+ }
+ else {
skipTest();
QUnit.start();
}
});
- test('avoids overwritten native methods', function() {
+ test('avoids overwritten native methods', 3, function() {
function message(methodName) {
return '`_.' + methodName + '` should avoid overwritten native methods';
}
@@ -288,11 +292,11 @@
QUnit.module('lodash constructor');
(function() {
- test('creates a new instance when called without the `new` operator', function() {
+ test('creates a new instance when called without the `new` operator', 1, function() {
ok(_() instanceof _);
});
- test('should return provided `lodash` instances', function() {
+ test('should return provided `lodash` instances', 1,function() {
var wrapped = _(false);
equal(_(wrapped), wrapped);
});
@@ -303,7 +307,7 @@
QUnit.module('lodash.assign');
(function() {
- test('should not error on `null` or `undefined` sources (test in IE < 9)', function() {
+ test('should not error on `null` or `undefined` sources (test in IE < 9)', 1, function() {
try {
deepEqual(_.assign({}, null, undefined, { 'a': 1 }), { 'a': 1 });
} catch(e) {
@@ -319,31 +323,31 @@
(function() {
var args = arguments;
- test('should return `undefined` for nonexistent keys', function() {
+ test('should return `undefined` for nonexistent keys', 1, function() {
var actual = _.at(['a', 'b', 'c'], [0, 2, 4]);
deepEqual(actual, ['a', 'c', undefined]);
});
- test('should return an empty array when no keys are provided', function() {
+ test('should return an empty array when no keys are provided', 1, function() {
deepEqual(_.at(['a', 'b', 'c']), []);
});
- test('should accept multiple key arguments', function() {
+ test('should accept multiple key arguments', 1, function() {
var actual = _.at(['a', 'b', 'c', 'd'], 0, 2, 3);
deepEqual(actual, ['a', 'c', 'd']);
});
- test('should work with an `arguments` object for `collection`', function() {
+ test('should work with an `arguments` object for `collection`', 1, function() {
var actual = _.at(args, [0, 2]);
deepEqual(actual, ['a', 'c']);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var actual = _.at({ 'a': 1, 'b': 2, 'c': 3 }, ['a', 'c']);
deepEqual(actual, [1, 3]);
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.at);
@@ -355,7 +359,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection`', function() {
+ test('should work with a string ' + key + ' for `collection`', 1, function() {
deepEqual(_.at(collection, [0, 2]), ['a', 'c']);
});
});
@@ -366,7 +370,7 @@
QUnit.module('lodash.bind');
(function() {
- test('should append array arguments to partially applied arguments (test in IE < 9)', function() {
+ test('should append array arguments to partially applied arguments (test in IE < 9)', 1, function() {
var args,
bound = _.bind(function() { args = slice.call(arguments); }, {}, 'a');
@@ -374,14 +378,14 @@
deepEqual(args, ['a', ['b'], 'c']);
});
- test('ensure `new bound` is an instance of `func`', function() {
+ test('ensure `new bound` is an instance of `func`', 1, function() {
var func = function() {},
bound = _.bind(func, {});
ok(new bound instanceof func);
});
- test('should throw a TypeError if `func` is not a function', function() {
+ test('should throw a TypeError if `func` is not a function', 1, function() {
raises(function() { _.bind(); }, TypeError);
});
}());
@@ -393,7 +397,7 @@
(function() {
var args = arguments;
- test('should bind all methods of `object`', function() {
+ test('should bind all methods of `object`', 1, function() {
function Foo() {
this._a = 1;
this._b = 2;
@@ -412,7 +416,7 @@
deepEqual(actual, [1, 2]);
});
- test('should accept arrays of method names', function() {
+ test('should accept arrays of method names', 1, function() {
var object = {
'_a': 1,
'_b': 2,
@@ -433,13 +437,13 @@
deepEqual(actual, [1, 2, 3, undefined]);
});
- test('should work with an array `object` argument', function() {
+ test('should work with an array `object` argument', 1, function() {
var array = ['push', 'pop'];
_.bindAll(array);
equal(array.pop, Array.prototype.pop);
});
- test('should work with `arguments` objects as secondary arguments', function() {
+ test('should work with `arguments` objects as secondary arguments', 1, function() {
var object = {
'_a': 1,
'a': function() { return this._a; }
@@ -460,7 +464,7 @@
QUnit.module('lodash.bindKey');
(function() {
- test('should work when the target function is overwritten', function() {
+ test('should work when the target function is overwritten', 2, function() {
var object = {
'name': 'moe',
'greet': function(greeting) {
@@ -484,17 +488,17 @@
QUnit.module('lodash.chain');
(function() {
- test('should return a wrapped value', function() {
+ test('should return a wrapped value', 1, function() {
var actual = _.chain({ 'a': 0 });
ok(actual instanceof _);
});
- test('should return the existing wrapper when chaining', function() {
+ test('should return the existing wrapper when chaining', 1, function() {
var wrapper = _({ 'a': 0 });
equal(wrapper.chain(), wrapper);
});
- test('should enable chaining of methods that return unwrapped values by default', function() {
+ test('should enable chaining of methods that return unwrapped values by default', 6, function() {
var array = ['abc'];
ok(_.chain(array).first() instanceof _);
@@ -542,42 +546,22 @@
objects['an array'].length = 5;
- _.forOwn(objects, function(object, key) {
- test('should deep clone ' + key, function() {
- var clone = _.cloneDeep(object);
- strictEqual(_.isEqual(object, clone), true);
+ test('`_.clone` should shallow clone by default', 2, function() {
+ var expected = [{ 'a': 0 }, { 'b': 1 }],
+ actual = _.clone(expected);
- if (_.isObject(object)) {
- notEqual(clone, object);
- } else {
- skipTest();
- }
- });
- });
-
- _.forOwn(nonCloneable, function(object, key) {
- test('should not clone ' + key, function() {
- strictEqual(_.clone(object), object);
- strictEqual(_.cloneDeep(object), object);
- });
+ deepEqual(actual, expected);
+ ok(actual != expected && actual[0] === expected[0]);
});
- test('should perform a shallow clone when used as `callback` for `_.map`', function() {
+ test('`_.clone` should perform a shallow clone when used as `callback` for `_.map`', 1, function() {
var expected = [{ 'a': [0] }, { 'b': [1] }],
actual = _.map(expected, _.clone);
ok(actual[0] != expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b);
});
- test('should deep clone `index` and `input` array properties', function() {
- var array = /x/.exec('x'),
- actual = _.cloneDeep(array);
-
- strictEqual(actual.index, 0);
- equal(actual.input, 'x');
- });
-
- test('should deep clone objects with circular references', function() {
+ test('`_.cloneDeep` should deep clone objects with circular references', 1, function() {
var object = {
'foo': { 'b': { 'foo': { 'c': { } } } },
'bar': { }
@@ -590,13 +574,6 @@
ok(clone.bar.b === clone.foo.b && clone === clone.foo.b.foo.c && clone !== object);
});
- test('should clone problem JScript properties (test in IE < 9)', function() {
- deepEqual(_.clone(shadowedObject), shadowedObject);
- notEqual(_.clone(shadowedObject), shadowedObject);
- deepEqual(_.cloneDeep(shadowedObject), shadowedObject);
- notEqual(_.cloneDeep(shadowedObject), shadowedObject);
- });
-
_.forEach([
'clone',
'cloneDeep'
@@ -605,7 +582,31 @@
var func = _[methodName],
klass = new Klass;
- test('`_.' + methodName + '` should pass the correct `callback` arguments', function() {
+ _.forOwn(objects, function(object, key) {
+ test('`_.' + methodName + '` should clone ' + key, 2, function() {
+ var clone = func(object);
+ strictEqual(_.isEqual(object, clone), true);
+
+ if (_.isObject(object)) {
+ notEqual(clone, object);
+ } else {
+ strictEqual(clone, object);
+ }
+ });
+ });
+
+ _.forOwn(nonCloneable, function(object, key) {
+ test('`_.' + methodName + '` should not clone ' + key, 1, function() {
+ strictEqual(func(object), object);
+ });
+ });
+
+ test('`_.' + methodName + '` should clone problem JScript properties (test in IE < 9)', 2, function() {
+ deepEqual(func(shadowedObject), shadowedObject);
+ notEqual(func(shadowedObject), shadowedObject);
+ });
+
+ test('`_.' + methodName + '` should pass the correct `callback` arguments', 1, function() {
var args;
func(klass, function() {
@@ -615,7 +616,7 @@
deepEqual(args, [klass]);
});
- test('`_.' + methodName + '` should correct set the `this` binding', function() {
+ test('`_.' + methodName + '` should correct set the `this` binding', 1, function() {
var actual = func('a', function(value) {
return this[value];
}, { 'a': 'A' });
@@ -623,11 +624,28 @@
equal(actual, 'A');
});
- test('`_.' + methodName + '` should handle cloning if `callback` returns `undefined`', function() {
- var actual = _.clone({ 'a': { 'b': 'c' } }, function() {});
+ test('`_.' + methodName + '` should handle cloning if `callback` returns `undefined`', 1, function() {
+ var actual = func({ 'a': { 'b': 'c' } }, function() {});
deepEqual(actual, { 'a': { 'b': 'c' } });
});
- });
+
+ test('`_.' + methodName + '` should deep clone `index` and `input` array properties', 2, function() {
+ var array = /x/.exec('vwxyz'),
+ actual = func(array);
+
+ strictEqual(actual.index, 2);
+ equal(actual.input, 'vwxyz');
+ });
+
+ test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', 1, function() {
+ // avoid a regexp literal for older Opera and use `exec` for older Safari
+ var regexp = RegExp('x', 'g');
+ regexp.exec('vwxyz');
+
+ var actual = func(regexp);
+ equal(actual.lastIndex, 3);
+ });
+ })
}(1, 2, 3));
/*--------------------------------------------------------------------------*/
@@ -642,22 +660,22 @@
'a string': '123123'
},
function(collection, key) {
- test('should work with ' + key + ' and a positive `fromIndex`', function() {
+ test('should work with ' + key + ' and a positive `fromIndex`', 1, function() {
strictEqual(_.contains(collection, 1, 2), true);
});
- test('should work with ' + key + ' and a `fromIndex` >= collection\'s length', function() {
+ test('should work with ' + key + ' and a `fromIndex` >= collection\'s length', 4, function() {
strictEqual(_.contains(collection, 1, 6), false);
strictEqual(_.contains(collection, undefined, 6), false);
strictEqual(_.contains(collection, 1, 8), false);
strictEqual(_.contains(collection, undefined, 8), false);
});
- test('should work with ' + key + ' and a negative `fromIndex`', function() {
+ test('should work with ' + key + ' and a negative `fromIndex`', 1, function() {
strictEqual(_.contains(collection, 2, -3), true);
});
- test('should work with ' + key + ' and a negative `fromIndex` <= negative collection\'s length', function() {
+ test('should work with ' + key + ' and a negative `fromIndex` <= negative collection\'s length', 2, function() {
strictEqual(_.contains(collection, 1, -6), true);
strictEqual(_.contains(collection, 2, -8), true);
});
@@ -668,7 +686,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection`', function() {
+ test('should work with a string ' + key + ' for `collection`', 2, function() {
strictEqual(_.contains(collection, 'bc'), true);
strictEqual(_.contains(collection, 'd'), false);
});
@@ -680,12 +698,12 @@
QUnit.module('lodash.countBy');
(function() {
- test('should use `_.identity` when no `callback` is provided', function() {
+ test('should use `_.identity` when no `callback` is provided', 1, function() {
var actual = _.countBy([4, 6, 6]);
deepEqual(actual, { '4': 1, '6': 2 });
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.countBy([4.2, 6.1, 6.4], function(num) {
return this.floor(num);
}, Math);
@@ -693,7 +711,7 @@
deepEqual(actual, { '4': 1, '6': 2 });
});
- test('should only add values to own, not inherited, properties', function() {
+ test('should only add values to own, not inherited, properties', 2, function() {
var actual = _.countBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
@@ -702,7 +720,7 @@
deepEqual(actual.hasOwnProperty, 2);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var actual = _.countBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) {
return Math.floor(num);
});
@@ -710,7 +728,7 @@
deepEqual(actual, { '4': 1, '6': 2 });
});
- test('should work with a number for `callback`', function() {
+ test('should work with a number for `callback`', 2, function() {
var array = [
[1, 'a'],
[2, 'a'],
@@ -727,7 +745,7 @@
QUnit.module('lodash.createCallback');
(function() {
- test('should work with functions created by `_.partial` and `_.partialRight`', function() {
+ test('should work with functions created by `_.partial` and `_.partialRight`', 2, function() {
function func() {
var result = [this.x];
push.apply(result, arguments);
@@ -743,7 +761,7 @@
deepEqual(callback(2), expected);
});
- test('should work without an `argCount`', function() {
+ test('should work without an `argCount`', 1, function() {
var args,
expected = ['a', 'b', 'c', 'd', 'e'];
@@ -761,7 +779,7 @@
QUnit.module('lodash.curry');
(function() {
- test('should curry based on the number of arguments provided', function() {
+ test('should curry based on the number of arguments provided', 3, function() {
function func(a, b, c) {
return a + b + c;
}
@@ -773,7 +791,7 @@
equal(curried(1, 2, 3), 6);
});
- test('should work with partial methods', function() {
+ test('should work with partial methods', 2, function() {
function func(a, b, c) {
return a + b + c;
}
@@ -787,7 +805,7 @@
equal(c(), 6);
});
- test('should not alter the `this` binding', function() {
+ test('should not alter the `this` binding', 9, function() {
function func(a, b, c) {
var value = this || {};
return value[a] + value[b] + value[c];
@@ -816,126 +834,161 @@
QUnit.module('lodash.debounce');
(function() {
- test('subsequent "immediate" debounced calls return the last `func` result', function() {
- var debounced = _.debounce(_.identity, 32, true),
- result = [debounced('x'), debounced('y')];
+ test('subsequent "immediate" debounced calls return the last `func` result', 1, function() {
+ if (!(isRhino && isModularize)) {
+ var debounced = _.debounce(_.identity, 32, true),
+ result = [debounced('x'), debounced('y')];
- deepEqual(result, ['x', 'x']);
+ deepEqual(result, ['x', 'x']);
+ }
+ else {
+ skipTest();
+ }
});
- asyncTest('subsequent debounced calls return the last `func` result', function() {
- var debounced = _.debounce(_.identity, 32);
- debounced('x');
+ asyncTest('subsequent debounced calls return the last `func` result', 1, function() {
+ if (!(isRhino && isModularize)) {
+ var debounced = _.debounce(_.identity, 32);
+ debounced('x');
- setTimeout(function() {
- equal(debounced('y'), 'x');
+ setTimeout(function() {
+ equal(debounced('y'), 'x');
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest();
QUnit.start();
- }, 64);
+ }
});
- asyncTest('should apply default options correctly', function() {
- var count = 0;
+ asyncTest('should apply default options correctly', 2, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0;
- var debounced = _.debounce(function(value) {
- count++;
- return value;
- }, 32, {});
+ var debounced = _.debounce(function(value) {
+ count++;
+ return value;
+ }, 32, {});
- strictEqual(debounced('x'), undefined);
+ strictEqual(debounced('x'), undefined);
- setTimeout(function() {
- strictEqual(count, 1);
+ setTimeout(function() {
+ strictEqual(count, 1);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(2);
QUnit.start();
- }, 64);
+ }
});
- asyncTest('should work with `leading` option', function() {
- var withLeadingAndTrailing,
- counts = [0, 0, 0];
+ asyncTest('should work with `leading` option', 7, function() {
+ if (!(isRhino && isModularize)) {
+ var withLeadingAndTrailing,
+ counts = [0, 0, 0];
- _.forEach([true, { 'leading': true }], function(options, index) {
- var debounced = _.debounce(function(value) {
- counts[index]++;
- return value;
- }, 32, options);
+ _.forEach([true, { 'leading': true }], function(options, index) {
+ var debounced = _.debounce(function(value) {
+ counts[index]++;
+ return value;
+ }, 32, options);
- if (index == 1) {
- withLeadingAndTrailing = debounced;
- }
- equal(debounced('x'), 'x');
- });
+ if (index == 1) {
+ withLeadingAndTrailing = debounced;
+ }
+ equal(debounced('x'), 'x');
+ });
- _.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true }));
- strictEqual(counts[2], 1);
+ _.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true }));
+ strictEqual(counts[2], 1);
- _.forEach([false, { 'leading': false }], function(options) {
- var withoutLeading = _.debounce(_.identity, 32, options);
- strictEqual(withoutLeading('x'), undefined);
- });
+ _.forEach([false, { 'leading': false }], function(options) {
+ var withoutLeading = _.debounce(_.identity, 32, options);
+ strictEqual(withoutLeading('x'), undefined);
+ });
- setTimeout(function() {
- deepEqual(counts, [1, 1, 2]);
+ setTimeout(function() {
+ deepEqual(counts, [1, 1, 2]);
- withLeadingAndTrailing('x');
- equal(counts[1], 2);
+ withLeadingAndTrailing('x');
+ equal(counts[1], 2);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(7);
QUnit.start();
- }, 64);
+ }
});
- asyncTest('should work with `trailing` option', function() {
- var withCount = 0,
- withoutCount = 0;
+ asyncTest('should work with `trailing` option', 4, function() {
+ if (!(isRhino && isModularize)) {
+ var withCount = 0,
+ withoutCount = 0;
- var withTrailing = _.debounce(function(value) {
- withCount++;
- return value;
- }, 32, { 'trailing': true });
+ var withTrailing = _.debounce(function(value) {
+ withCount++;
+ return value;
+ }, 32, { 'trailing': true });
- var withoutTrailing = _.debounce(function(value) {
- withoutCount++;
- return value;
- }, 32, { 'trailing': false });
+ var withoutTrailing = _.debounce(function(value) {
+ withoutCount++;
+ return value;
+ }, 32, { 'trailing': false });
- strictEqual(withTrailing('x'), undefined);
- strictEqual(withoutTrailing('x'), undefined);
+ strictEqual(withTrailing('x'), undefined);
+ strictEqual(withoutTrailing('x'), undefined);
- setTimeout(function() {
- strictEqual(withCount, 1);
- strictEqual(withoutCount, 0);
+ setTimeout(function() {
+ strictEqual(withCount, 1);
+ strictEqual(withoutCount, 0);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(4);
QUnit.start();
- }, 64);
+ }
});
- asyncTest('should work with `maxWait` option', function() {
- var limit = 100,
- withCount = 0,
- withoutCount = 0;
+ asyncTest('should work with `maxWait` option', 4, function() {
+ if (!(isRhino && isModularize)) {
+ var limit = 100,
+ withCount = 0,
+ withoutCount = 0;
- var withMaxWait = _.debounce(function() {
- withCount++;
- }, 32, { 'maxWait': 64 });
+ var withMaxWait = _.debounce(function() {
+ withCount++;
+ }, 32, { 'maxWait': 64 });
- var withoutMaxWait = _.debounce(function() {
- withoutCount++;
- }, 32);
+ var withoutMaxWait = _.debounce(function() {
+ withoutCount++;
+ }, 32);
- var start = new Date;
- while ((new Date - start) < limit) {
- withMaxWait();
- withoutMaxWait();
- }
- strictEqual(withCount, 1);
- strictEqual(withoutCount, 0);
+ var start = new Date;
+ while ((new Date - start) < limit) {
+ withMaxWait();
+ withoutMaxWait();
+ }
+ strictEqual(withCount, 1);
+ strictEqual(withoutCount, 0);
- var lastWithCount = withCount,
- lastWithoutCount = withoutCount;
+ var lastWithCount = withCount,
+ lastWithoutCount = withoutCount;
- setTimeout(function() {
- ok(withCount > lastWithCount);
- ok(withoutCount > lastWithoutCount && withoutCount < withCount);
+ setTimeout(function() {
+ ok(withCount > lastWithCount);
+ ok(withoutCount > lastWithoutCount && withoutCount < withCount);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(4);
QUnit.start();
- }, 64);
+ }
});
}());
@@ -944,12 +997,12 @@
QUnit.module('lodash.defaults');
(function() {
- test('should not overwrite `null` values', function() {
+ test('should not overwrite `null` values', 1, function() {
var actual = _.defaults({ 'a': null }, { 'a': 1 });
strictEqual(actual.a, null);
});
- test('should overwrite `undefined` values', function() {
+ test('should overwrite `undefined` values', 1, function() {
var actual = _.defaults({ 'a': undefined }, { 'a': 1 });
strictEqual(actual.a, 1);
});
@@ -960,11 +1013,17 @@
QUnit.module('lodash.defer');
(function() {
- asyncTest('should accept additional arguments', function() {
- _.defer(function() {
- deepEqual(slice.call(arguments), [1, 2, 3]);
+ asyncTest('should accept additional arguments', 1, function() {
+ if (!(isRhino && isModularize)) {
+ _.defer(function() {
+ deepEqual(slice.call(arguments), [1, 2, 3]);
+ QUnit.start();
+ }, 1, 2, 3);
+ }
+ else {
+ skipTest();
QUnit.start();
- }, 1, 2, 3);
+ }
});
}());
@@ -973,7 +1032,7 @@
QUnit.module('lodash.difference');
(function() {
- test('should work with large arrays', function() {
+ test('should work with large arrays', 1, function() {
var array1 = _.range(largeArraySize),
array2 = array1.slice(),
a = {},
@@ -986,7 +1045,7 @@
deepEqual(_.difference(array1, array2), []);
});
- test('should not accept individual secondary values', function() {
+ test('should not accept individual secondary values', 1, function() {
var array = [1, null, 3];
deepEqual(_.difference(array, null, 3), array);
});
@@ -997,15 +1056,15 @@
QUnit.module('lodash.escape');
(function() {
- test('should not escape the "/" character', function() {
+ test('should not escape the "/" character', 1, function() {
equal(_.escape('/'), '/');
});
- test('should escape "\'" to "'"', function() {
+ test('should escape "\'" to "'"', 1, function() {
equal(_.escape("'"), "'");
});
- test('should return an empty string when provided `null` or `undefined`', function() {
+ test('should return an empty string when provided `null` or `undefined`', 2, function() {
equal(_.escape(null), '');
equal(_.escape(undefined), '');
});
@@ -1016,7 +1075,7 @@
QUnit.module('lodash.every');
(function() {
- test('should return `false` as soon as the `callback` result is falsey', function() {
+ test('should return `false` as soon as the `callback` result is falsey', 1, function() {
strictEqual(_.every([true, null, true], _.identity), false);
});
}());
@@ -1028,13 +1087,13 @@
_.forEach(['assign', 'defaults', 'merge'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should not assign inherited `source` properties', function() {
+ test('`_.' + methodName + '` should not assign inherited `source` properties', 1, function() {
function Foo() {}
Foo.prototype = { 'a': 1 };
deepEqual(func({}, new Foo), {});
});
- test('should work when used as `callback` for `_.reduce`', function() {
+ test('should work when used as `callback` for `_.reduce`', 1, function() {
var array = [{ 'a': 1 }, { 'b': 2 }, { 'c': 3 }],
actual = _.reduce(array, _.merge);
@@ -1042,7 +1101,7 @@
});
if (methodName == 'merge') {
- test('`_.' + methodName + '` should treat sparse arrays as dense', function() {
+ test('`_.' + methodName + '` should treat sparse arrays as dense', 2, function() {
var array = Array(3);
array[0] = 1;
array[2] = 3;
@@ -1065,7 +1124,7 @@
_.forEach(['assign', 'bindAll', 'defaults'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should not throw strict mode errors', function() {
+ test('`_.' + methodName + '` should not throw strict mode errors', 1, function() {
var object = { 'a': null, 'b': function(){} },
pass = true;
@@ -1093,7 +1152,7 @@
QUnit.module('lodash.filter');
(function() {
- test('should not modify the resulting value from within `callback`', function() {
+ test('should not modify the resulting value from within `callback`', 1, function() {
var actual = _.filter([0], function(num, index, array) {
return (array[index] = 1);
});
@@ -1124,23 +1183,23 @@
var func = _[methodName];
- test('should return the correct value', function() {
+ test('should return the correct value', 1, function() {
strictEqual(func(objects, function(object) { return object.a; }), expected[0]);
});
- test('should work with a `thisArg`', function() {
+ test('should work with a `thisArg`', 1, function() {
strictEqual(func(objects, function(object, index) { return this[index].a; }, objects), expected[0]);
});
- test('should return `' + expected[1] + '` if value is not found', function() {
+ test('should return `' + expected[1] + '` if value is not found', 1, function() {
strictEqual(func(objects, function(object) { return object.a == 3; }), expected[1]);
});
- test('should work with an object for `callback`', function() {
+ test('should work with an object for `callback`', 1, function() {
strictEqual(func(objects, { 'b': 2 }), expected[2]);
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
strictEqual(func(objects, 'b'), expected[3]);
});
});
@@ -1159,38 +1218,38 @@
{ 'a': 0, 'b': 0 }
];
- test('should return the first element', function() {
+ test('should return the first element', 1, function() {
strictEqual(_.first(array), 1);
});
- test('should return the first two elements', function() {
+ test('should return the first two elements', 1, function() {
deepEqual(_.first(array, 2), [1, 2]);
});
- test('should return an empty array when `n` < `1`', function() {
+ test('should return an empty array when `n` < `1`', 3, function() {
_.each([0, -1, -2], function(n) {
deepEqual(_.first(array, n), []);
});
});
- test('should return all elements when `n` >= `array.length`', function() {
+ test('should return all elements when `n` >= `array.length`', 2, function() {
_.each([3, 4], function(n) {
deepEqual(_.first(array, n), array.slice());
});
});
- test('should return `undefined` when querying empty arrays', function() {
+ test('should return `undefined` when querying empty arrays', 1, function() {
strictEqual(_.first([]), undefined);
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.first);
deepEqual(actual, [1, 4, 7]);
});
- test('should work with a `callback`', function() {
+ test('should work with a `callback`', 1, function() {
var actual = _.first(array, function(num) {
return num < 3;
});
@@ -1198,7 +1257,7 @@
deepEqual(actual, [1, 2]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.first(array, function() {
@@ -1208,7 +1267,7 @@
deepEqual(args, [1, 0, array]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.first(array, function(num, index) {
return this[index] < 3;
}, array);
@@ -1216,7 +1275,7 @@
deepEqual(actual, [1, 2]);
});
- test('should chain when passing `n`, `callback`, or `thisArg`', function() {
+ test('should chain when passing `n`, `callback`, or `thisArg`', 3, function() {
var actual = _(array).first(2);
ok(actual instanceof _);
@@ -1234,16 +1293,16 @@
ok(actual instanceof _);
});
- test('should not chain when arguments are not provided', function() {
+ test('should not chain when arguments are not provided', 1, function() {
var actual = _(array).first();
strictEqual(actual, 1);
});
- test('should work with an object for `callback`', function() {
+ test('should work with an object for `callback`', 1, function() {
deepEqual(_.first(objects, { 'b': 2 }), objects.slice(0, 1));
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
deepEqual(_.first(objects, 'b'), objects.slice(0, 2));
});
}());
@@ -1256,12 +1315,12 @@
var args = arguments,
array = [{ 'a': [1, [2]] }, { 'a': [3] }];
- test('should flatten `arguments` objects', function() {
+ test('should flatten `arguments` objects', 1, function() {
var actual = _.flatten([args, args]);
deepEqual(actual, [1, 2, 3, 1, 2, 3]);
});
- test('should work with a `callback`', function() {
+ test('should work with a `callback`', 1, function() {
var actual = _.flatten(array, function(object) {
return object.a;
});
@@ -1269,7 +1328,7 @@
deepEqual(actual, [1, 2, 3]);
});
- test('should work with `isShallow` and `callback`', function() {
+ test('should work with `isShallow` and `callback`', 1, function() {
var actual = _.flatten(array, true, function(object) {
return object.a;
});
@@ -1277,7 +1336,7 @@
deepEqual(actual, [1, [2], 3]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.flatten(array, function() {
@@ -1287,7 +1346,7 @@
deepEqual(args, [{ 'a': [1, [2]] }, 0, array]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.flatten(array, function(object, index) {
return this[index].a;
}, array);
@@ -1295,18 +1354,18 @@
deepEqual(actual, [1, 2, 3]);
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
deepEqual(_.flatten(array, 'a'), [1, 2, 3]);
});
- test('should perform a deep flatten when used as `callback` for `_.map`', function() {
+ test('should perform a deep flatten when used as `callback` for `_.map`', 1, function() {
var array = [[[['a']]], [[['b']]]],
actual = _.map(array, _.flatten);
deepEqual(actual, [['a'], ['b']]);
});
- test('should treat sparse arrays as dense', function() {
+ test('should treat sparse arrays as dense', 4, function() {
var array = [[1, 2, 3], Array(3)],
expected = [1, 2, 3],
actual1 = _.flatten(array),
@@ -1321,7 +1380,7 @@
ok(4 in actual2);
});
- test('should work with extremely large arrays', function() {
+ test('should work with extremely large arrays', 1, function() {
var expected = Array(5e5),
pass = true;
@@ -1341,7 +1400,7 @@
}
});
- test('should work with empty arrays', function() {
+ test('should work with empty arrays', 1, function() {
var actual = _.flatten([[], [[]], [[], [[[]]]]]);
deepEqual(actual, []);
});
@@ -1354,17 +1413,17 @@
_.forEach(['forEach', 'forEachRight'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should return the collection', function() {
+ test('`_.' + methodName + '` should return the collection', 1, function() {
var collection = [1, 2, 3];
equal(func(collection, Boolean), collection);
});
- test('`_.' + methodName + '` should return the existing wrapper when chaining', function() {
+ test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() {
var wrapper = _([1, 2, 3]);
equal(wrapper[methodName](Boolean), wrapper);
});
- test('`_.' + methodName + '` should support the `thisArg` argument', function() {
+ test('`_.' + methodName + '` should support the `thisArg` argument', 2, function() {
var actual;
function callback(num, index) {
@@ -1383,7 +1442,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('`_.' + methodName + '` should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
+ test('`_.' + methodName + '` should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() {
var args,
values = [];
@@ -1410,7 +1469,7 @@
_.forEach(['forIn', 'forInRight'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` iterates over inherited properties', function() {
+ test('`_.' + methodName + '` iterates over inherited properties', 1, function() {
function Foo() { this.a = 1; }
Foo.prototype.b = 2;
@@ -1419,7 +1478,7 @@
deepEqual(keys.sort(), ['a', 'b']);
});
- test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug with inherited properties (test in IE < 9)', function() {
+ test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug with inherited properties (test in IE < 9)', 1, function() {
function Foo() {}
Foo.prototype = shadowedObject;
@@ -1440,7 +1499,7 @@
_.forEach(['forOwn', 'forOwnRight'], function(methodName) {
var func = _[methodName];
- test('iterates over the `length` property', function() {
+ test('iterates over the `length` property', 1, function() {
var object = { '0': 'zero', '1': 'one', 'length': 2 },
props = [];
@@ -1456,13 +1515,13 @@
_.forEach(['forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
+ test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
var props = [];
func(shadowedObject, function(value, prop) { props.push(prop); });
deepEqual(props.sort(), shadowedProps);
});
- test('`_.' + methodName + '` does not iterate over non-enumerable properties (test in IE < 9)', function() {
+ test('`_.' + methodName + '` does not iterate over non-enumerable properties (test in IE < 9)', 10, function() {
_.forOwn({
'Array': Array.prototype,
'Boolean': Boolean.prototype,
@@ -1492,7 +1551,7 @@
});
});
- test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
+ test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() {
function Foo() {}
Foo.prototype.a = 1;
@@ -1516,13 +1575,13 @@
_.forEach(['assign', 'defaults', 'merge'], function(methodName) {
var func = _[methodName];
- test('should return the existing wrapper when chaining', function() {
+ test('should return the existing wrapper when chaining', 1, function() {
var wrapper = _({ 'a': 1 });
equal(wrapper[methodName]({ 'b': 2 }), wrapper);
});
- test('`_.' + methodName + '` should assign problem JScript properties (test in IE < 9)', function() {
+ test('`_.' + methodName + '` should assign problem JScript properties (test in IE < 9)', 1, function() {
var object = {
'constructor': '0',
'hasOwnProperty': '1',
@@ -1543,7 +1602,7 @@
deepEqual(func(object, source), shadowedObject);
});
- test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
+ test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() {
function Foo() {}
Foo.prototype.c = 3;
@@ -1557,7 +1616,7 @@
deepEqual(func({}, Foo), expected);
});
- test('`_.' + methodName + '` should work with `_.reduce`', function() {
+ test('`_.' + methodName + '` should work with `_.reduce`', 1, function() {
var actual = { 'a': 1},
array = [{ 'b': 2 }, { 'c': 3 }];
@@ -1569,7 +1628,7 @@
_.forEach(['assign', 'merge'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should pass the correct `callback` arguments', function() {
+ test('`_.' + methodName + '` should pass the correct `callback` arguments', 2, function() {
var args;
func({ 'a': 1 }, { 'a': 2 }, function() {
args || (args = slice.call(arguments));
@@ -1588,7 +1647,7 @@
deepEqual(args, [array, object], 'non-primitive property values');
});
- test('`_.' + methodName + '` should correct set the `this` binding', function() {
+ test('`_.' + methodName + '` should correct set the `this` binding', 1, function() {
var actual = func({}, { 'a': 0 }, function(a, b) {
return this[b];
}, [2]);
@@ -1596,7 +1655,7 @@
deepEqual(actual, { 'a': 2 });
});
- test('`_.' + methodName + '` should not treat the second argument as a `callback`', function() {
+ test('`_.' + methodName + '` should not treat the second argument as a `callback`', 2, function() {
function callback() {}
callback.b = 2;
@@ -1615,7 +1674,7 @@
_.forEach(['forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` can exit early when iterating arrays', function() {
+ test('`_.' + methodName + '` can exit early when iterating arrays', 1, function() {
var array = [1, 2, 3],
values = [];
@@ -1623,7 +1682,7 @@
deepEqual(values, [/Right/.test(methodName) ? 3 : 1]);
});
- test('`_.' + methodName + '` can exit early when iterating objects', function() {
+ test('`_.' + methodName + '` can exit early when iterating objects', 1, function() {
var object = { 'a': 1, 'b': 2, 'c': 3 },
values = [];
@@ -1645,14 +1704,14 @@
return count % 2 ? stringObject : stringLiteral;
});
- test('internal data objects should work with the `__proto__` key', function() {
+ test('internal data objects should work with the `__proto__` key', 4, function() {
deepEqual(_.difference(array, array), []);
deepEqual(_.intersection(array, array), expected);
deepEqual(_.uniq(array), expected);
deepEqual(_.without.apply(_, [array].concat(array)), []);
});
- test('lodash.memoize should memoize values resolved to the `__proto__` key', function() {
+ test('lodash.memoize should memoize values resolved to the `__proto__` key', 1, function() {
var count = 0,
memoized = _.memoize(function() { return ++count; });
@@ -1667,12 +1726,12 @@
QUnit.module('lodash.groupBy');
(function() {
- test('should use `_.identity` when no `callback` is provided', function() {
+ test('should use `_.identity` when no `callback` is provided', 1, function() {
var actual = _.groupBy([4, 6, 6]);
deepEqual(actual, { '4': [4], '6': [6, 6] });
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.groupBy([4.2, 6.1, 6.4], function(num) {
return this.floor(num);
}, Math);
@@ -1680,7 +1739,7 @@
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
});
- test('should only add values to own, not inherited, properties', function() {
+ test('should only add values to own, not inherited, properties', 2, function() {
var actual = _.groupBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
@@ -1689,7 +1748,7 @@
deepEqual(actual.hasOwnProperty, [6.1, 6.4]);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var actual = _.groupBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) {
return Math.floor(num);
});
@@ -1697,7 +1756,7 @@
deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] });
});
- test('should work with a number for `callback`', function() {
+ test('should work with a number for `callback`', 2, function() {
var array = [
[1, 'a'],
[2, 'a'],
@@ -1714,12 +1773,12 @@
QUnit.module('lodash.indexBy');
(function() {
- test('should use `_.identity` when no `callback` is provided', function() {
+ test('should use `_.identity` when no `callback` is provided', 1, function() {
var actual = _.indexBy([4, 6, 6]);
deepEqual(actual, { '4': 4, '6': 6 });
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.indexBy([4.2, 6.1, 6.4], function(num) {
return this.floor(num);
}, Math);
@@ -1727,7 +1786,7 @@
deepEqual(actual, { '4': 4.2, '6': 6.4 });
});
- test('should only add values to own, not inherited, properties', function() {
+ test('should only add values to own, not inherited, properties', 2, function() {
var actual = _.indexBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
});
@@ -1736,7 +1795,7 @@
deepEqual(actual.hasOwnProperty, 6.4);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var actual = _.indexBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) {
return Math.floor(num);
});
@@ -1744,7 +1803,7 @@
deepEqual(actual, { '4': 4.2, '6': 6.4 });
});
- test('should work with a number for `callback`', function() {
+ test('should work with a number for `callback`', 2, function() {
var array = [
[1, 'a'],
[2, 'a'],
@@ -1761,7 +1820,7 @@
QUnit.module('lodash.has');
(function() {
- test('should return `false` for primitives', function() {
+ test('should return `false` for primitives', 9, function() {
_.forEach(falsey.concat(1, 'a'), function(value) {
strictEqual(_.has(value, 'valueOf'), false);
});
@@ -1775,31 +1834,31 @@
(function() {
var array = [1, 2, 3, 1, 2, 3];
- test('should work with a positive `fromIndex`', function() {
+ test('should work with a positive `fromIndex`', 1, function() {
equal(_.indexOf(array, 1, 2), 3);
});
- test('should work with `fromIndex` >= `array.length`', function() {
+ test('should work with `fromIndex` >= `array.length`', 4, function() {
equal(_.indexOf(array, 1, 6), -1);
equal(_.indexOf(array, undefined, 6), -1);
equal(_.indexOf(array, 1, 8), -1);
equal(_.indexOf(array, undefined, 8), -1);
});
- test('should work with a negative `fromIndex`', function() {
+ test('should work with a negative `fromIndex`', 1, function() {
equal(_.indexOf(array, 2, -3), 4);
});
- test('should work with a negative `fromIndex` <= `-array.length`', function() {
+ test('should work with a negative `fromIndex` <= `-array.length`', 2, function() {
strictEqual(_.indexOf(array, 1, -6), 0);
strictEqual(_.indexOf(array, 2, -8), 1);
});
- test('should ignore non-number `fromIndex` values', function() {
+ test('should ignore non-number `fromIndex` values', 1, function() {
strictEqual(_.indexOf([1, 2, 3], 1, '1'), 0);
});
- test('should work with `isSorted`', function() {
+ test('should work with `isSorted`', 1, function() {
strictEqual(_.indexOf([1, 2, 3], 1, true), 0);
});
}());
@@ -1829,47 +1888,51 @@
var array = [1, new Foo, 3, new Foo],
indexOf = _.indexOf;
- test('`_.contains` should work with a custom `_.indexOf` method', function() {
+ test('`_.contains` should work with a custom `_.indexOf` method', 1, function() {
if (!isModularize) {
_.indexOf = custom;
ok(_.contains(array, new Foo));
_.indexOf = indexOf;
- } else {
+ }
+ else {
skipTest();
}
});
- test('`_.difference` should work with a custom `_.indexOf` method', function() {
+ test('`_.difference` should work with a custom `_.indexOf` method', 1, function() {
if (!isModularize) {
_.indexOf = custom;
deepEqual(_.difference(array, [new Foo]), [1, 3]);
_.indexOf = indexOf;
- } else {
+ }
+ else {
skipTest();
}
});
- test('`_.intersection` should work with a custom `_.indexOf` method', function() {
+ test('`_.intersection` should work with a custom `_.indexOf` method', 1, function() {
if (!isModularize) {
_.indexOf = custom;
deepEqual(_.intersection(array, [new Foo]), [array[1]]);
_.indexOf = indexOf;
- } else {
+ }
+ else {
skipTest();
}
});
- test('`_.omit` should work with a custom `_.indexOf` method', function() {
+ test('`_.omit` should work with a custom `_.indexOf` method', 1, function() {
if (!isModularize) {
_.indexOf = custom;
deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 });
_.indexOf = indexOf;
- } else {
+ }
+ else {
skipTest();
}
});
- test('`_.uniq` should work with a custom `_.indexOf` method', function() {
+ test('`_.uniq` should work with a custom `_.indexOf` method', 2, function() {
if (!isModularize) {
_.indexOf = custom;
deepEqual(_.uniq(array), array.slice(0, 3));
@@ -1880,7 +1943,8 @@
deepEqual(_.uniq(largeArray), [largeArray[0]]);
_.indexOf = indexOf;
- } else {
+ }
+ else {
skipTest(2);
}
});
@@ -1899,7 +1963,7 @@
{ 'a': 2, 'b': 2 }
];
- test('should accept a falsey `array` argument', function() {
+ test('should accept a falsey `array` argument', 7, function() {
_.forEach(falsey, function(index, value) {
try {
var actual = index ? _.initial(value) : _.initial();
@@ -1908,38 +1972,38 @@
})
});
- test('should exclude last element', function() {
+ test('should exclude last element', 1, function() {
deepEqual(_.initial(array), [1, 2]);
});
- test('should exclude the last two elements', function() {
+ test('should exclude the last two elements', 1, function() {
deepEqual(_.initial(array, 2), [1]);
});
- test('should return an empty when querying empty arrays', function() {
+ test('should return an empty when querying empty arrays', 1, function() {
deepEqual(_.initial([]), []);
});
- test('should return all elements when `n` < `1`', function() {
+ test('should return all elements when `n` < `1`', 3, function() {
_.each([0, -1, -2], function(n) {
deepEqual(_.initial(array, n), array.slice());
});
});
- test('should return an empty array when `n` >= `array.length`', function() {
+ test('should return an empty array when `n` >= `array.length`', 2, function() {
_.each([3, 4], function(n) {
deepEqual(_.initial(array, n), []);
});
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.initial);
deepEqual(actual, [[1, 2], [4, 5], [7, 8]]);
});
- test('should work with a `callback`', function() {
+ test('should work with a `callback`', 1, function() {
var actual = _.initial(array, function(num) {
return num > 1;
});
@@ -1947,7 +2011,7 @@
deepEqual(actual, [1]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.initial(array, function() {
@@ -1957,7 +2021,7 @@
deepEqual(args, [3, 2, array]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.initial(array, function(num, index) {
return this[index] > 1;
}, array);
@@ -1965,11 +2029,11 @@
deepEqual(actual, [1]);
});
- test('should work with an object for `callback`', function() {
+ test('should work with an object for `callback`', 1, function() {
deepEqual(_.initial(objects, { 'b': 2 }), objects.slice(0, 2));
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
deepEqual(_.initial(objects, 'b'), objects.slice(0, 1));
});
}());
@@ -1979,7 +2043,7 @@
QUnit.module('lodash.invoke');
(function() {
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var object = { 'a': 1, 'b': 2, 'c': 3 };
deepEqual(_.invoke(object, 'toFixed', 1), ['1.0', '2.0', '3.0']);
});
@@ -1990,10 +2054,10 @@
QUnit.module('lodash.isElement');
(function() {
- test('should use strict equality in its duck type check', function() {
+ test('should use strict equality in its duck type check', 6, function() {
var element = body || { 'nodeType': 1 };
- strictEqual(_.isElement(element), true);
+ strictEqual(_.isElement(element), true);
strictEqual(_.isElement({ 'nodeType': new Number(1) }), false);
strictEqual(_.isElement({ 'nodeType': true }), false);
strictEqual(_.isElement({ 'nodeType': [1] }), false);
@@ -2009,11 +2073,11 @@
(function() {
var args = arguments;
- test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
+ test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
equal(_.isEmpty(shadowedObject), false);
});
- test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
+ test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() {
function Foo() {}
Foo.prototype.a = 1;
strictEqual(_.isEmpty(Foo), true);
@@ -2022,18 +2086,18 @@
strictEqual(_.isEmpty(Foo), true);
});
- test('should work with an object that has a `length` property', function() {
+ test('should work with an object that has a `length` property', 1, function() {
strictEqual(_.isEmpty({ 'length': 0 }), false);
});
- test('should work with jQuery/MooTools DOM query collections', function() {
+ test('should work with jQuery/MooTools DOM query collections', 1, function() {
function Foo(elements) { push.apply(this, elements); }
Foo.prototype = { 'length': 0, 'splice': Array.prototype.splice };
strictEqual(_.isEmpty(new Foo([])), true);
});
- test('should work with `arguments` objects (test in IE < 9)', function() {
+ test('should work with `arguments` objects (test in IE < 9)', 1, function() {
if (!isPhantomPage) {
strictEqual(_.isEmpty(args), false);
} else {
@@ -2047,7 +2111,7 @@
QUnit.module('lodash.isEqual');
(function() {
- test('should work with `arguments` objects (test in IE < 9)', function() {
+ test('should work with `arguments` objects (test in IE < 9)', 2, function() {
var args1 = (function() { return arguments; }(1, 2, 3)),
args2 = (function() { return arguments; }(1, 2, 3)),
args3 = (function() { return arguments; }(1, 2));
@@ -2060,11 +2124,11 @@
}
});
- test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
+ test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
strictEqual(_.isEqual(shadowedObject, {}), false);
});
- test('should return `true` for like-objects from different documents', function() {
+ test('should return `true` for like-objects from different documents', 1, function() {
// ensure `_._object` is assigned (unassigned in Opera 10.00)
if (_._object) {
var object = { 'a': 1, 'b': 2, 'c': 3 };
@@ -2074,7 +2138,7 @@
}
});
- test('should return `false` when comparing values with circular references to unlike values', function() {
+ test('should return `false` when comparing values with circular references to unlike values', 2, function() {
var array1 = ['a', null, 'c'],
array2 = ['a', [], 'c'],
object1 = { 'a': 1, 'b': null, 'c': 3 },
@@ -2087,7 +2151,7 @@
strictEqual(_.isEqual(object1, object2), false);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.isEqual('a', 'b', function() {
@@ -2097,7 +2161,7 @@
deepEqual(args, ['a', 'b']);
});
- test('should correct set the `this` binding', function() {
+ test('should correct set the `this` binding', 1, function() {
var actual = _.isEqual('a', 'b', function(a, b) {
return this[a] == this[b];
}, { 'a': 1, 'b': 1 });
@@ -2105,12 +2169,12 @@
strictEqual(actual, true);
});
- test('should handle comparisons if `callback` returns `undefined`', function() {
+ test('should handle comparisons if `callback` returns `undefined`', 1, function() {
var actual = _.isEqual('a', 'a', function() {});
strictEqual(actual, true);
});
- test('should return a boolean value even if `callback` does not', function() {
+ test('should return a boolean value even if `callback` does not', 8, function() {
var actual = _.isEqual('a', 'a', function() { return 'a'; });
strictEqual(actual, true);
@@ -2120,7 +2184,7 @@
});
});
- test('should ensure `callback` is a function', function() {
+ test('should ensure `callback` is a function', 1, function() {
var array = [1, 2, 3],
eq = _.partial(_.isEqual, array),
actual = _.every([array, [1, 0, 3]], eq);
@@ -2134,7 +2198,7 @@
QUnit.module('lodash.isFinite');
(function() {
- test('should return `false` for non-numeric values', function() {
+ test('should return `false` for non-numeric values', 6, function() {
strictEqual(_.isFinite(null), false);
strictEqual(_.isFinite([]), false);
strictEqual(_.isFinite(true), false);
@@ -2143,7 +2207,7 @@
strictEqual(_.isFinite('2px'), false);
});
- test('should return `true` for numeric string values', function() {
+ test('should return `true` for numeric string values', 3, function() {
strictEqual(_.isFinite('2'), true);
strictEqual(_.isFinite('0'), true);
strictEqual(_.isFinite('08'), true);
@@ -2155,7 +2219,7 @@
QUnit.module('lodash.isObject');
(function() {
- test('should avoid V8 bug #2291', function() {
+ test('should avoid V8 bug #2291', 1, function() {
// trigger V8 bug
// http://code.google.com/p/v8/issues/detail?id=2291
var obj = {},
@@ -2175,7 +2239,7 @@
QUnit.module('lodash.isNaN');
(function() {
- test('returns `true` for `new Number(NaN)`', function() {
+ test('returns `true` for `new Number(NaN)`', 1, function() {
strictEqual(_.isNaN(new Number(NaN)), true);
});
}());
@@ -2185,7 +2249,7 @@
QUnit.module('lodash.isNumber');
(function() {
- test('should avoid `[xpconnect wrapped native prototype]` in Firefox', function() {
+ test('should avoid `[xpconnect wrapped native prototype]` in Firefox', 1, function() {
strictEqual(_.isNumber(+"2"), true);
});
}());
@@ -2195,7 +2259,7 @@
QUnit.module('lodash.isPlainObject');
(function() {
- test('should detect plain objects', function() {
+ test('should detect plain objects', 5, function() {
function Foo(a) {
this.a = 1;
}
@@ -2216,11 +2280,11 @@
}
});
- test('should return `true` for empty objects', function() {
+ test('should return `true` for empty objects', 1, function() {
strictEqual(_.isPlainObject({}), true);
});
- test('should return `false` for Object objects without a [[Class]] of "Object"', function() {
+ test('should return `false` for Object objects without a [[Class]] of "Object"', 4, function() {
strictEqual(_.isPlainObject(arguments), false);
strictEqual(_.isPlainObject(Error), false);
strictEqual(_.isPlainObject(Math), false);
@@ -2253,7 +2317,7 @@
function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should return a boolean', function() {
+ test('`_.' + methodName + '` should return a boolean', 15, function() {
var expected = 'boolean';
equal(typeof func(arguments), expected);
@@ -2275,7 +2339,7 @@
});
(function() {
- test('should return `false` for subclassed values', function() {
+ test('should return `false` for subclassed values', 7, function() {
_.forEach(['isArray', 'isBoolean', 'isDate', 'isFunction', 'isNumber', 'isRegExp', 'isString'], function(methodName) {
function Foo() {}
Foo.prototype = root[methodName.slice(2)].prototype;
@@ -2297,7 +2361,7 @@
(function() {
var args = arguments;
- test('should work with `arguments` objects (test in IE < 9)', function() {
+ test('should work with `arguments` objects (test in IE < 9)', 1, function() {
if (!isPhantomPage) {
deepEqual(_.keys(args), ['0', '1', '2']);
} else {
@@ -2305,7 +2369,7 @@
}
});
- test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
+ test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 2, function() {
function Foo() {}
Foo.prototype.a = 1;
@@ -2313,7 +2377,7 @@
deepEqual(_.keys(shadowedObject).sort(), shadowedProps);
});
- test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() {
+ test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() {
function Foo() {}
Foo.prototype.c = 3;
@@ -2341,38 +2405,38 @@
{ 'a': 2, 'b': 2 }
];
- test('should return the last element', function() {
+ test('should return the last element', 1, function() {
equal(_.last(array), 3);
});
- test('should return the last two elements', function() {
+ test('should return the last two elements', 1, function() {
deepEqual(_.last(array, 2), [2, 3]);
});
- test('should return an empty array when `n` < `1`', function() {
+ test('should return an empty array when `n` < `1`', 3, function() {
_.each([0, -1, -2], function(n) {
deepEqual(_.last(array, n), []);
});
});
- test('should return all elements when `n` >= `array.length`', function() {
+ test('should return all elements when `n` >= `array.length`', 2, function() {
_.each([3, 4], function(n) {
deepEqual(_.last(array, n), array.slice());
});
});
- test('should return `undefined` when querying empty arrays', function() {
+ test('should return `undefined` when querying empty arrays', 1, function() {
strictEqual(_.last([]), undefined);
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.last);
deepEqual(actual, [3, 6, 9]);
});
- test('should work with a `callback`', function() {
+ test('should work with a `callback`', 1, function() {
var actual = _.last(array, function(num) {
return num > 1;
});
@@ -2380,7 +2444,7 @@
deepEqual(actual, [2, 3]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.last(array, function() {
@@ -2390,7 +2454,7 @@
deepEqual(args, [3, 2, array]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.last(array, function(num, index) {
return this[index] > 1;
}, array);
@@ -2398,7 +2462,7 @@
deepEqual(actual, [2, 3]);
});
- test('should chain when passing `n`, `callback`, or `thisArg`', function() {
+ test('should chain when passing `n`, `callback`, or `thisArg`', 3, function() {
var actual = _(array).last(2);
ok(actual instanceof _);
@@ -2416,16 +2480,16 @@
ok(actual instanceof _);
});
- test('should not chain when arguments are not provided', function() {
+ test('should not chain when arguments are not provided', 1, function() {
var actual = _(array).last();
equal(actual, 3);
});
- test('should work with an object for `callback`', function() {
+ test('should work with an object for `callback`', 1, function() {
deepEqual(_.last(objects, { 'b': 2 }), objects.slice(-1));
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
deepEqual(_.last(objects, 'b'), objects.slice(-2));
});
}());
@@ -2437,27 +2501,27 @@
(function() {
var array = [1, 2, 3, 1, 2, 3];
- test('should work with a positive `fromIndex`', function() {
+ test('should work with a positive `fromIndex`', 1, function() {
strictEqual(_.lastIndexOf(array, 1, 2), 0);
});
- test('should work with `fromIndex` >= `array.length`', function() {
+ test('should work with `fromIndex` >= `array.length`', 4, function() {
equal(_.lastIndexOf(array, undefined, 6), -1);
equal(_.lastIndexOf(array, 1, 6), 3);
equal(_.lastIndexOf(array, undefined, 8), -1);
equal(_.lastIndexOf(array, 1, 8), 3);
});
- test('should work with a negative `fromIndex`', function() {
+ test('should work with a negative `fromIndex`', 1, function() {
strictEqual(_.lastIndexOf(array, 2, -3), 1);
});
- test('should work with a negative `fromIndex` <= `-array.length`', function() {
+ test('should work with a negative `fromIndex` <= `-array.length`', 2, function() {
strictEqual(_.lastIndexOf(array, 1, -6), 0);
equal(_.lastIndexOf(array, 2, -8), -1);
});
- test('should ignore non-number `fromIndex` values', function() {
+ test('should ignore non-number `fromIndex` values', 2, function() {
equal(_.lastIndexOf([1, 2, 3], 3, '1'), 2);
equal(_.lastIndexOf([1, 2, 3], 3, true), 2);
});
@@ -2468,12 +2532,12 @@
QUnit.module('lodash.map');
(function() {
- test('should return the correct result when iterating an object', function() {
+ test('should return the correct result when iterating an object', 1, function() {
var actual = _.map({ 'a': 1, 'b': 2, 'c': 3 });
deepEqual(actual, [1, 2, 3]);
});
- test('should handle object arguments with non-numeric length properties', function() {
+ test('should handle object arguments with non-numeric length properties', 1, function() {
if (defineProperty) {
var object = {};
defineProperty(object, 'length', { 'value': 'x' });
@@ -2491,7 +2555,7 @@
_.forEach(['max', 'min'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should iterate an object', function() {
+ test('`_.' + methodName + '` should iterate an object', 1, function() {
var actual = func({ 'a': 1, 'b': 2, 'c': 3 });
equal(actual, methodName == 'max' ? 3 : 1);
});
@@ -2504,7 +2568,7 @@
_.forEach(['max', 'min'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` should iterate a string', function() {
+ test('`_.' + methodName + '` should iterate a string', 2, function() {
_.forEach(['abc', Object('abc')], function(value) {
var actual = func(value);
equal(actual, methodName == 'max' ? 'c' : 'a');
@@ -2517,7 +2581,7 @@
QUnit.module('lodash.max and lodash.min chaining');
_.forEach(['max', 'min'], function(methodName) {
- test('`_.' + methodName + '` should resolve the correct value when provided an array containing only one value', function() {
+ test('`_.' + methodName + '` should resolve the correct value when provided an array containing only one value', 1, function() {
var actual = _([40])[methodName]().value();
strictEqual(actual, 40);
});
@@ -2528,7 +2592,7 @@
QUnit.module('lodash.memoize');
(function() {
- test('should expose a `cache` object on the `memoized` function', function() {
+ test('should expose a `cache` object on the `memoized` function', 2, function() {
var memoized = _.memoize(_.identity, _.identity);
memoized('x');
@@ -2546,7 +2610,7 @@
(function() {
var args = arguments;
- test('should merge `source` into the destination object', function() {
+ test('should merge `source` into the destination object', 1, function() {
var names = {
'stooges': [
{ 'name': 'moe' },
@@ -2578,7 +2642,7 @@
deepEqual(_.merge(names, ages, heights), expected);
});
- test('should merge sources containing circular references', function() {
+ test('should merge sources containing circular references', 1, function() {
var object = {
'foo': { 'a': 1 },
'bar': { 'a': 2 }
@@ -2596,7 +2660,7 @@
ok(actual.bar.b === actual.foo.b && actual.foo.b.foo.c === actual.foo.b.foo.c.foo.b.foo.c);
});
- test('should not treat `arguments` objects as plain objects', function() {
+ test('should not treat `arguments` objects as plain objects', 1, function() {
var object = {
'args': args
};
@@ -2609,34 +2673,34 @@
equal(_.isArguments(actual.args), false);
});
- test('should work with four arguments', function() {
+ test('should work with four arguments', 1, function() {
var expected = { 'a': 4 };
deepEqual(_.merge({ 'a': 1 }, { 'a': 2 }, { 'a': 3 }, expected), expected);
});
- test('should assign `null` values', function() {
+ test('should assign `null` values', 1, function() {
var actual = _.merge({ 'a': 1 }, { 'a': null });
strictEqual(actual.a, null);
});
- test('should not assign `undefined` values', function() {
+ test('should not assign `undefined` values', 1, function() {
var actual = _.merge({ 'a': 1 }, { 'a': undefined });
strictEqual(actual.a, 1);
});
- test('should handle merging if `callback` returns `undefined`', function() {
+ test('should handle merging if `callback` returns `undefined`', 1, function() {
var actual = _.merge({ 'a': { 'b': [1, 1] } }, { 'a': { 'b': [0] } }, function() {});
deepEqual(actual, { 'a': { 'b': [0, 1] } });
});
- test('should defer to `callback` when it returns a value other than `undefined`', function() {
+ test('should defer to `callback` when it returns a value other than `undefined`', 1, function() {
var actual = _.merge({ 'a': { 'b': [0, 1] } }, { 'a': { 'b': [2] } }, function(a, b) {
return _.isArray(a) ? a.concat(b) : undefined;
});
deepEqual(actual, { 'a': { 'b': [0, 1, 2] } });
});
- test('should pass the correct values to `callback`', function() {
+ test('should pass the correct values to `callback`', 1, function() {
var argsList = [],
array = [1, 2],
object = { 'b': 2 };
@@ -2654,13 +2718,13 @@
QUnit.module('lodash.mixin');
(function() {
- test('should accept an `object` argument', function() {
+ test('should accept an `object` argument', 1, function() {
var lodash = {};
_.mixin(lodash, { 'a': function(a) { return a[0]; } });
strictEqual(lodash.a(['a']), 'a');
});
- test('should accept a function `object` argument', function() {
+ test('should accept a function `object` argument', 1, function() {
function lodash(value) {
if (!(this instanceof lodash)) {
return new lodash(value);
@@ -2684,34 +2748,34 @@
object = { 'a': 1, 'b': 2 },
expected = { 'b': 2 };
- test('should accept individual property names', function() {
+ test('should accept individual property names', 1, function() {
deepEqual(_.omit(object, 'a'), expected);
});
- test('should accept an array of property names', function() {
+ test('should accept an array of property names', 1, function() {
deepEqual(_.omit(object, ['a', 'c']), expected);
});
- test('should accept mixes of individual and arrays of property names', function() {
+ test('should accept mixes of individual and arrays of property names', 1, function() {
deepEqual(_.omit(object, ['a'], 'c'), expected);
});
- test('should iterate over inherited properties', function() {
+ test('should iterate over inherited properties', 1, function() {
function Foo() {}
Foo.prototype = object;
deepEqual(_.omit(new Foo, 'a'), expected);
});
- test('should work with `arguments` objects as secondary arguments', function() {
+ test('should work with `arguments` objects as secondary arguments', 1, function() {
deepEqual(_.omit(object, args), expected);
});
- test('should work with an array `object` argument', function() {
+ test('should work with an array `object` argument', 1, function() {
deepEqual(_.omit([1, 2, 3], '0', '2'), { '1': 2 });
});
- test('should work with a `callback` argument', function() {
+ test('should work with a `callback` argument', 1, function() {
var actual = _.omit(object, function(num) {
return num === 1;
});
@@ -2719,7 +2783,7 @@
deepEqual(actual, expected);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args,
lastKey = _.keys(object).pop();
@@ -2734,7 +2798,7 @@
deepEqual(args, expected);
});
- test('should correct set the `this` binding', function() {
+ test('should correct set the `this` binding', 1, function() {
var actual = _.omit(object, function(num) {
return num === this.a;
}, { 'a': 1 });
@@ -2748,7 +2812,7 @@
QUnit.module('lodash.once');
(function() {
- test('should ignore recursive calls', function() {
+ test('should ignore recursive calls', 1, function() {
var count = 0;
var func = _.once(function() {
@@ -2760,7 +2824,7 @@
strictEqual(count, 1);
});
- test('should not throw more than once', function() {
+ test('should not throw more than once', 2, function() {
var pass = true;
var func = _.once(function() {
@@ -2783,19 +2847,19 @@
QUnit.module('lodash.parseInt');
(function() {
- test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', function() {
+ test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', 2, function() {
var whitespace = ' \x09\x0B\x0C\xA0\ufeff\x0A\x0D\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000';
equal(_.parseInt('08'), 8);
equal(_.parseInt(whitespace + '08'), 8);
});
- test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', function() {
+ test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', 3, function() {
equal(_.parseInt('10', 0), 10);
equal(_.parseInt('10'), 10);
equal(_.parseInt('10', undefined), 10);
});
- test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', function() {
+ test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', 3, function() {
equal(_.parseInt('0x20', 0), 32);
equal(_.parseInt('0x20'), 32);
equal(_.parseInt('0x20', undefined), 32);
@@ -2809,14 +2873,14 @@
_.forEach(['partial', 'partialRight'], function(methodName) {
var func = _[methodName];
- test('`_.' + methodName + '` partially applies an argument, without additional arguments', function() {
+ test('`_.' + methodName + '` partially applies an argument, without additional arguments', 1, function() {
var arg = 'a',
fn = function(x) { return x; };
equal(func(fn, arg)(), arg);
});
- test('`_.' + methodName + '` partially applies an argument, with additional arguments', function() {
+ test('`_.' + methodName + '` partially applies an argument, with additional arguments', 1, function() {
var arg1 = 'a',
arg2 = 'b',
expected = [arg1, arg2],
@@ -2828,19 +2892,19 @@
deepEqual(func(fn, arg1)(arg2), expected);
});
- test('`_.' + methodName + '` works without partially applying arguments, without additional arguments', function() {
+ test('`_.' + methodName + '` works without partially applying arguments, without additional arguments', 1, function() {
var fn = function() { return arguments.length; };
strictEqual(func(fn)(), 0);
});
- test('`_.' + methodName + '` works without partially applying arguments, with additional arguments', function() {
+ test('`_.' + methodName + '` works without partially applying arguments, with additional arguments', 1, function() {
var arg = 'a',
fn = function(x) { return x; };
equal(func(fn)(arg), arg);
});
- test('`_.' + methodName + '` should not alter the `this` binding', function() {
+ test('`_.' + methodName + '` should not alter the `this` binding', 3, function() {
var object = { 'a': 1 },
fn = function() { return this.a; };
@@ -2857,7 +2921,7 @@
QUnit.module('lodash.partialRight');
(function() {
- test('should work as a deep `_.defaults`', function() {
+ test('should work as a deep `_.defaults`', 1, function() {
var object = { 'a': { 'b': 1 } },
source = { 'a': { 'b': 2, 'c': 3 } },
expected = { 'a': { 'b': 1, 'c': 3 } };
@@ -2872,7 +2936,7 @@
QUnit.module('methods using `createBound`');
(function() {
- test('combinations of partial functions should work', function() {
+ test('combinations of partial functions should work', 1, function() {
function func() {
return slice.call(arguments);
}
@@ -2883,7 +2947,7 @@
deepEqual(c(2), [1, 2, 3]);
});
- test('combinations of bound and partial functions should work', function() {
+ test('combinations of bound and partial functions should work', 3, function() {
function func() {
var result = [this.x];
push.apply(result, arguments);
@@ -2911,7 +2975,7 @@
deepEqual(c(3), expected);
});
- test('recursively bound functions should work', function() {
+ test('recursively bound functions should work', 1, function() {
function func() {
return this.x;
}
@@ -2932,22 +2996,22 @@
object = { 'a': 1, 'b': 2 },
expected = { 'b': 2 };
- test('should iterate over inherited properties', function() {
+ test('should iterate over inherited properties', 1, function() {
function Foo() {}
Foo.prototype = object;
deepEqual(_.pick(new Foo, 'b'), expected);
});
- test('should work with `arguments` objects as secondary arguments', function() {
+ test('should work with `arguments` objects as secondary arguments', 1, function() {
deepEqual(_.pick(object, args), expected);
});
- test('should work with an array `object` argument', function() {
+ test('should work with an array `object` argument', 1, function() {
deepEqual(_.pick([1, 2, 3], '1'), { '1': 2 });
});
- test('should work with a `callback` argument', function() {
+ test('should work with a `callback` argument', 1, function() {
var actual = _.pick(object, function(num) {
return num === 2;
});
@@ -2955,7 +3019,7 @@
deepEqual(actual, expected);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args,
lastKey = _.keys(object).pop();
@@ -2970,7 +3034,7 @@
deepEqual(args, expected);
});
- test('should correct set the `this` binding', function() {
+ test('should correct set the `this` binding', 1, function() {
var actual = _.pick(object, function(num) {
return num === this.b;
}, { 'b': 2 });
@@ -2984,7 +3048,7 @@
QUnit.module('lodash.pluck');
(function() {
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var object = { 'a': [1], 'b': [1, 2], 'c': [1, 2, 3] };
deepEqual(_.pluck(object, 'length'), [1, 2, 3]);
});
@@ -2995,7 +3059,7 @@
QUnit.module('lodash.pull');
(function() {
- test('should modify and return the array', function() {
+ test('should modify and return the array', 2, function() {
var array = [1, 2, 3],
actual = _.pull(array, 1, 3);
@@ -3003,7 +3067,7 @@
ok(actual === array);
});
- test('should preserve holes in arrays', function() {
+ test('should preserve holes in arrays', 2, function() {
var array = [1, 2, 3, 4];
delete array[1];
delete array[3];
@@ -3013,7 +3077,7 @@
equal(2 in array, false);
});
- test('should treat holes as `undefined`', function() {
+ test('should treat holes as `undefined`', 1, function() {
var array = [1, 2, 3];
delete array[1];
@@ -3027,12 +3091,12 @@
QUnit.module('lodash.random');
(function() {
- test('should return `0` or `1` when arguments are not provided', function() {
+ test('should return `0` or `1` when arguments are not provided', 1, function() {
var actual = _.random();
ok(actual === 0 || actual === 1);
});
- test('supports not passing a `max` argument', function() {
+ test('supports not passing a `max` argument', 1, function() {
var actual = _.random(5),
limit = 60,
start = new Date;
@@ -3043,7 +3107,7 @@
notEqual(actual, 5);
});
- test('supports large integer values', function() {
+ test('supports large integer values', 2, function() {
var array = Array(1000),
min = Math.pow(2, 31),
max = Math.pow(2, 62);
@@ -3057,11 +3121,11 @@
}), true);
});
- test('should coerce arguments to numbers', function() {
+ test('should coerce arguments to numbers', 1, function() {
strictEqual(_.random('1', '1'), 1);
});
- test('should support floats', function() {
+ test('should support floats', 2, function() {
var min = 1.5,
max = 1.6,
actual = _.random(min, max);
@@ -3070,7 +3134,7 @@
ok(actual >= min && actual <= max);
});
- test('supports passing a `floating` argument', function() {
+ test('supports passing a `floating` argument', 3, function() {
var actual = _.random(true);
ok(actual % 1 && actual >= 0 && actual <= 1);
@@ -3089,7 +3153,7 @@
(function() {
var func = _.range;
- test('should treat falsey `start` arguments as `0`', function() {
+ test('should treat falsey `start` arguments as `0`', 13, function() {
_.forEach(falsey, function(value, index) {
if (index) {
deepEqual(_.range(value), []);
@@ -3100,12 +3164,12 @@
});
});
- test('should coerce arguments to numbers', function() {
+ test('should coerce arguments to numbers', 1, function() {
var actual = [func('0',1), func('1'), func(0, 1, '1')];
deepEqual(actual, [[0], [0], [0]]);
});
- test('should support a `step` of `0`', function() {
+ test('should support a `step` of `0`', 1, function() {
deepEqual(_.range(1, 4, 0), [1, 1, 1]);
});
}());
@@ -3115,7 +3179,7 @@
QUnit.module('lodash.reduce');
(function() {
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args,
array = [1, 2, 3];
@@ -3131,7 +3195,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
+ test('should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() {
var args;
var actual = _.reduce(collection, function(accumulator, value) {
@@ -3150,7 +3214,7 @@
QUnit.module('lodash.reduceRight');
(function() {
- test('should pass the correct `callback` arguments when iterating an array', function() {
+ test('should pass the correct `callback` arguments when iterating an array', 1, function() {
var args,
array = [1, 2, 3];
@@ -3161,7 +3225,7 @@
deepEqual(args, [3, 2, 1, array]);
});
- test('should pass the correct `callback` arguments when iterating an object', function() {
+ test('should pass the correct `callback` arguments when iterating an object', 1, function() {
var args,
object = { 'a': 1, 'b': 2 },
lastKey = _.keys(object).pop();
@@ -3182,7 +3246,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() {
+ test('should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() {
var args;
var actual = _.reduceRight(collection, function(accumulator, value) {
@@ -3201,7 +3265,7 @@
QUnit.module('lodash.remove');
(function() {
- test('should modify the array and return removed elements', function() {
+ test('should modify the array and return removed elements', 2, function() {
var array = [1, 2, 3];
var actual = _.remove(array, function(num) {
@@ -3212,7 +3276,7 @@
deepEqual(actual, [1, 2]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args,
array = [1, 2, 3];
@@ -3223,7 +3287,7 @@
deepEqual(args, [1, 0, array]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var array = [1, 2, 3];
var actual = _.remove(array, function(num, index) {
@@ -3233,7 +3297,7 @@
deepEqual(actual, [1, 2]);
});
- test('should preserve holes in arrays', function() {
+ test('should preserve holes in arrays', 2, function() {
var array = [1, 2, 3, 4];
delete array[1];
delete array[3];
@@ -3243,7 +3307,7 @@
equal(2 in array, false);
});
- test('should treat holes as `undefined`', function() {
+ test('should treat holes as `undefined`', 1, function() {
var array = [1, 2, 3];
delete array[1];
@@ -3257,7 +3321,7 @@
QUnit.module('lodash.result');
(function() {
- test('should return `undefined` when provided a falsey `object` argument', function() {
+ test('should return `undefined` when provided a falsey `object` argument', 1, function() {
strictEqual(_.result(), undefined);
});
}());
@@ -3275,7 +3339,7 @@
{ 'a': 0, 'b': 0 }
];
- test('should accept a falsey `array` argument', function() {
+ test('should accept a falsey `array` argument', 7, function() {
_.forEach(falsey, function(index, value) {
try {
var actual = index ? _.rest(value) : _.rest();
@@ -3284,38 +3348,38 @@
})
});
- test('should exclude the first element', function() {
+ test('should exclude the first element', 1, function() {
deepEqual(_.rest(array), [2, 3]);
});
- test('should exclude the first two elements', function() {
+ test('should exclude the first two elements', 1, function() {
deepEqual(_.rest(array, 2), [3]);
});
- test('should return all elements when `n` < `1`', function() {
+ test('should return all elements when `n` < `1`', 3, function() {
_.each([0, -1, -2], function(n) {
deepEqual(_.rest(array, n), [1, 2, 3]);
});
});
- test('should return an empty array when `n` >= `array.length`', function() {
+ test('should return an empty array when `n` >= `array.length`', 2, function() {
_.each([3, 4], function(n) {
deepEqual(_.rest(array, n), []);
});
});
- test('should return an empty when querying empty arrays', function() {
+ test('should return an empty when querying empty arrays', 1, function() {
deepEqual(_.rest([]), []);
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
actual = _.map(array, _.rest);
deepEqual(actual, [[2, 3], [5, 6], [8, 9]]);
});
- test('should work with a `callback`', function() {
+ test('should work with a `callback`', 1, function() {
var actual = _.rest(array, function(num) {
return num < 3;
});
@@ -3323,7 +3387,7 @@
deepEqual(actual, [3]);
});
- test('should pass the correct `callback` arguments', function() {
+ test('should pass the correct `callback` arguments', 1, function() {
var args;
_.rest(array, function() {
@@ -3333,7 +3397,7 @@
deepEqual(args, [1, 0, array]);
});
- test('supports the `thisArg` argument', function() {
+ test('supports the `thisArg` argument', 1, function() {
var actual = _.rest(array, function(num, index) {
return this[index] < 3;
}, array);
@@ -3341,11 +3405,11 @@
deepEqual(actual, [3]);
});
- test('should work with an object for `callback`', function() {
+ test('should work with an object for `callback`', 1, function() {
deepEqual(_.rest(objects, { 'b': 2 }), objects.slice(-2));
});
- test('should work with a string for `callback`', function() {
+ test('should work with a string for `callback`', 1, function() {
deepEqual(_.rest(objects, 'b'), objects.slice(-1));
});
}());
@@ -3355,7 +3419,7 @@
QUnit.module('lodash.runInContext');
(function() {
- test('should not require a fully populated `context` object', function() {
+ test('should not require a fully populated `context` object', 1, function() {
if (!isModularize) {
var lodash = _.runInContext({
'setTimeout': function(callback) {
@@ -3366,7 +3430,8 @@
var pass = false;
lodash.delay(function() { pass = true; }, 32);
ok(pass);
- } else {
+ }
+ else {
skipTest();
}
});
@@ -3379,33 +3444,33 @@
(function() {
var array = [1, 2, 3];
- test('should return a random element', function() {
+ test('should return a random element', 1, function() {
var actual = _.sample(array);
ok(_.contains(array, actual));
});
- test('should return two random elements', function() {
+ test('should return two random elements', 1, function() {
var actual = _.sample(array, 2);
ok(actual[0] !== actual[1] && _.contains(array, actual[0]) && _.contains(array, actual[1]));
});
- test('should return an empty array when `n` < `1`', function() {
+ test('should return an empty array when `n` < `1`', 3, function() {
_.each([0, -1, -2], function(n) {
deepEqual(_.sample(array, n), []);
});
});
- test('should return all elements when `n` >= `array.length`', function() {
+ test('should return all elements when `n` >= `array.length`', 2, function() {
_.each([3, 4], function(n) {
deepEqual(_.sample(array, n).sort(), array.slice());
});
});
- test('should return `undefined` when sampling an empty array', function() {
+ test('should return `undefined` when sampling an empty array', 1, function() {
strictEqual(_.sample([]), undefined);
});
- test('should sample an object', function() {
+ test('should sample an object', 2, function() {
var object = { 'a': 1, 'b': 2, 'c': 3 },
actual = _.sample(object);
@@ -3415,7 +3480,7 @@
ok(actual[0] !== actual[1] && _.contains(array, actual[0]) && _.contains(array, actual[1]));
});
- test('should work when used as `callback` for `_.map`', function() {
+ test('should work when used as `callback` for `_.map`', 1, function() {
var a = [1, 2, 3],
b = [4, 5, 6],
c = [7, 8, 9],
@@ -3424,12 +3489,12 @@
ok(_.contains(a, actual[0]) && _.contains(b, actual[1]) && _.contains(c, actual[2]));
});
- test('should chain when passing `n`', function() {
+ test('should chain when passing `n`', 1, function() {
var actual = _(array).sample(2);
ok(actual instanceof _);
});
- test('should not chain when arguments are not provided', function() {
+ test('should not chain when arguments are not provided', 1, function() {
var actual = _(array).sample();
ok(_.contains(array, actual));
});
@@ -3439,7 +3504,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection`', function() {
+ test('should work with a string ' + key + ' for `collection`', 2, function() {
var actual = _.sample(collection);
ok(_.contains(collection, actual));
@@ -3454,7 +3519,7 @@
QUnit.module('lodash.shuffle');
(function() {
- test('should shuffle an object', function() {
+ test('should shuffle an object', 1, function() {
var actual = _.shuffle({ 'a': 1, 'b': 2, 'c': 3 });
deepEqual(actual.sort(), [1, 2, 3]);
});
@@ -3464,7 +3529,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection`', function() {
+ test('should work with a string ' + key + ' for `collection`', 1, function() {
var actual = _.shuffle(collection);
deepEqual(actual.sort(), ['a','b', 'c']);
});
@@ -3478,7 +3543,7 @@
(function() {
var args = arguments;
- test('should accept a falsey `object` argument', function() {
+ test('should accept a falsey `object` argument', 7, function() {
_.forEach(falsey, function(index, value) {
try {
var actual = index ? _.size(value) : _.size();
@@ -3487,14 +3552,14 @@
})
});
- test('should work with jQuery/MooTools DOM query collections', function() {
+ test('should work with jQuery/MooTools DOM query collections', 1, function() {
function Foo(elements) { push.apply(this, elements); }
Foo.prototype = { 'length': 0, 'splice': Array.prototype.splice };
equal(_.size(new Foo([1, 2, 3])), 3);
});
- test('should work with `arguments` objects (test in IE < 9)', function() {
+ test('should work with `arguments` objects (test in IE < 9)', 1, function() {
if (!isPhantomPage) {
equal(_.size(args), 3);
} else {
@@ -3502,7 +3567,7 @@
}
});
- test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() {
+ test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() {
equal(_.size(shadowedObject), 7);
});
@@ -3511,7 +3576,7 @@
'object': Object('abc')
},
function(collection, key) {
- test('should work with a string ' + key + ' for `collection`', function() {
+ test('should work with a string ' + key + ' for `collection`', 1, function() {
deepEqual(_.size(collection), 3);
});
});
@@ -3522,7 +3587,7 @@
QUnit.module('lodash.some');
(function() {
- test('should return `true` as soon as the `callback` result is truey', function() {
+ test('should return `true` as soon as the `callback` result is truey', 1, function() {
strictEqual(_.some([null, true, null], _.identity), true);
});
}());
@@ -3532,7 +3597,7 @@
QUnit.module('lodash.sortBy');
(function() {
- test('should sort in ascending order', function() {
+ test('should sort in ascending order', 1, function() {
var actual = _.pluck(_.sortBy([
{ 'num': 991 },
{ 'num': 212 },
@@ -3546,7 +3611,7 @@
deepEqual(actual, [0, 11, 16, 74, 212, 991, 1515]);
});
- test('should perform a stable sort (test in IE > 8, Opera, and V8)', function() {
+ test('should perform a stable sort (test in IE > 8, Opera, and V8)', 1, function() {
function Pair(x, y) {
this.x = x;
this.y = y;
@@ -3571,12 +3636,12 @@
deepEqual(actual, collection);
});
- test('should use `_.identity` when no `callback` is provided', function() {
+ test('should use `_.identity` when no `callback` is provided', 1, function() {
var actual = _.sortBy([3, 2, 1]);
deepEqual(actual, [1, 2, 3]);
});
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.sortBy([1, 2, 3], function(num) {
return this.sin(num);
}, Math);
@@ -3584,7 +3649,7 @@
deepEqual(actual, [3, 1, 2]);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var actual = _.sortBy({ 'a': 1, 'b': 2, 'c': 3 }, function(num) {
return Math.sin(num);
});
@@ -3598,7 +3663,7 @@
QUnit.module('lodash.sortedIndex');
(function() {
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.sortedIndex([1, 2, 3], 4, function(num) {
return this.sin(num);
}, Math);
@@ -3606,7 +3671,7 @@
strictEqual(actual, 0);
});
- test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', function() {
+ test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', 1, function() {
var length = Math.pow(2, 32) - 1,
index = length - 1,
array = Array(length),
@@ -3623,11 +3688,11 @@
QUnit.module('lodash.support');
(function() {
- test('should contain properties with boolean values', function() {
+ test('should contain properties with boolean values', 1, function() {
ok(_.every(_.values(_.support), _.isBoolean));
});
- test('should not contain minified properties (test production builds)', function() {
+ test('should not contain minified properties (test production builds)', 1, function() {
var props = [
'argsClass',
'argsObject',
@@ -3653,20 +3718,20 @@
QUnit.module('lodash.template');
(function() {
- test('supports recursive calls', function() {
+ test('supports recursive calls', 1, function() {
var compiled = _.template('<%= a %><% a = _.template(c, obj) %><%= a %>'),
data = { 'a': 'A', 'b': 'B', 'c': '<%= b %>' };
equal(compiled(data), 'AB');
});
- test('should not augment the `options` object', function() {
+ test('should not augment the `options` object', 1, function() {
var options = {};
_.template('', null, options);
deepEqual(options, {});
});
- test('should provide the template source when a SyntaxError occurs', function() {
+ test('should provide the template source when a SyntaxError occurs', 1, function() {
try {
_.template('<% if x %>');
} catch(e) {
@@ -3675,7 +3740,7 @@
ok(/__p/.test(source));
});
- test('should work with complex "interpolate" delimiters', function() {
+ test('should work with complex "interpolate" delimiters', 22, function() {
_.forEach({
'<%= a + b %>': '3',
'<%= b - a %>': '1',
@@ -3708,14 +3773,14 @@
});
});
- test('should allow referencing variables declared in "evaluate" delimiters from other delimiters', function() {
+ test('should allow referencing variables declared in "evaluate" delimiters from other delimiters', 1, function() {
var compiled = _.template('<% var b = a; %><%= b.value %>'),
data = { 'a': { 'value': 1 } };
equal(compiled(data), '1');
});
- test('should work when passing `options.variable`', function() {
+ test('should work when passing `options.variable`', 1, function() {
var compiled = _.template(
'<% _.forEach( data.a, function( value ) { %>' +
'<%= value.valueOf() %>' +
@@ -3731,7 +3796,7 @@
}
});
- test('should not error with IE conditional comments enabled (test with development build)', function() {
+ test('should not error with IE conditional comments enabled (test with development build)', 1, function() {
var compiled = _.template(''),
pass = true;
@@ -3744,21 +3809,21 @@
ok(pass);
});
- test('should tokenize delimiters', function() {
+ test('should tokenize delimiters', 1, function() {
var compiled = _.template(''),
data = { 'type': 1 };
equal(compiled(data), '');
});
- test('should work with "interpolate" delimiters containing ternary operators', function() {
+ test('should work with "interpolate" delimiters containing ternary operators', 1, function() {
var compiled = _.template('<%= value ? value : "b" %>'),
data = { 'value': 'a' };
equal(compiled(data), 'a');
});
- test('should work with "interpolate" delimiters containing global values', function() {
+ test('should work with "interpolate" delimiters containing global values', 1, function() {
var compiled = _.template('<%= typeof Math.abs %>');
try {
@@ -3768,7 +3833,7 @@
equal(actual, 'function');
});
- test('should parse delimiters with newlines', function() {
+ test('should parse delimiters with newlines', 1, function() {
var expected = '<<\nprint("" + (value ? "yes" : "no") + "
")\n>>',
compiled = _.template(expected, null, { 'evaluate': /<<(.+?)>>/g }),
data = { 'value': true };
@@ -3776,13 +3841,13 @@
equal(compiled(data), expected);
});
- test('should parse ES6 template delimiters', function() {
+ test('should parse ES6 template delimiters', 2, function() {
var data = { 'value': 2 };
equal(_.template('1${value}3', data), '123');
equal(_.template('${"{" + value + "\\}"}', data), '{2}');
});
- test('supports the "imports" option', function() {
+ test('supports the "imports" option', 1, function() {
var options = { 'imports': { 'a': 1 } },
compiled = _.template('<%= a %>', null, options);
@@ -3795,14 +3860,19 @@
QUnit.module('lodash.throttle');
(function() {
- test('subsequent calls should return the result of the first call', function() {
- var throttled = _.throttle(function(value) { return value; }, 32),
- result = [throttled('x'), throttled('y')];
+ test('subsequent calls should return the result of the first call', 1, function() {
+ if (!(isRhino && isModularize)) {
+ var throttled = _.throttle(function(value) { return value; }, 32),
+ result = [throttled('x'), throttled('y')];
- deepEqual(result, ['x', 'x']);
+ deepEqual(result, ['x', 'x']);
+ }
+ else {
+ skipTest();
+ }
});
- test('should clear timeout when `func` is called', function() {
+ test('should clear timeout when `func` is called', 1, function() {
if (!isModularize) {
var callCount = 0,
dateCount = 0;
@@ -3828,128 +3898,169 @@
}
});
- asyncTest('supports recursive calls', function() {
- var count = 0;
- var throttled = _.throttle(function() {
- count++;
- if (count < 10) {
- throttled();
- }
- }, 32);
+ asyncTest('supports recursive calls', 2, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0;
+ var throttled = _.throttle(function() {
+ count++;
+ if (count < 10) {
+ throttled();
+ }
+ }, 32);
- throttled();
- equal(count, 1);
+ throttled();
+ equal(count, 1);
- setTimeout(function() {
- ok(count < 3)
+ setTimeout(function() {
+ ok(count < 3)
+ QUnit.start();
+ }, 32);
+ }
+ else {
+ skipTest(2);
QUnit.start();
- }, 32);
+ }
});
- asyncTest('should not trigger a trailing call when invoked once', function() {
- var count = 0,
- throttled = _.throttle(function() { count++; }, 32);
-
- throttled();
- equal(count, 1);
+ asyncTest('should not trigger a trailing call when invoked once', 2, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0,
+ throttled = _.throttle(function() { count++; }, 32);
- setTimeout(function() {
+ throttled();
equal(count, 1);
+
+ setTimeout(function() {
+ equal(count, 1);
+ QUnit.start();
+ }, 96);
+ }
+ else {
+ skipTest(2);
QUnit.start();
- }, 96);
+ }
});
_.times(2, function(index) {
- asyncTest('should trigger trailing call when invoked repeatedly' + (index ? ' and `leading` is `false`' : '') , function() {
- var count = 0,
- limit = 160,
- options = index ? { 'leading': false } : {},
- throttled = _.throttle(function() { count++; }, 64, options),
- start = new Date;
+ asyncTest('should trigger trailing call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), 2, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0,
+ limit = 160,
+ options = index ? { 'leading': false } : {},
+ throttled = _.throttle(function() { count++; }, 64, options),
+ start = new Date;
+
+ while ((new Date - start) < limit) {
+ throttled();
+ }
+ var lastCount = count;
+ ok(count > 1);
- while ((new Date - start) < limit) {
- throttled();
+ setTimeout(function() {
+ ok(count > lastCount);
+ QUnit.start();
+ }, 96);
}
- var lastCount = count;
- ok(count > 1);
-
- setTimeout(function() {
- ok(count > lastCount);
+ else {
+ skipTest(2);
QUnit.start();
- }, 96);
+ }
});
});
- asyncTest('should apply default options correctly', function() {
- var count = 0;
+ asyncTest('should apply default options correctly', 3, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0;
- var throttled = _.throttle(function(value) {
- count++;
- return value;
- }, 32, {});
+ var throttled = _.throttle(function(value) {
+ count++;
+ return value;
+ }, 32, {});
- _.times(2, function() {
- equal(throttled('x'), 'x');
- });
+ _.times(2, function() {
+ equal(throttled('x'), 'x');
+ });
- setTimeout(function() {
- strictEqual(count, 2);
+ setTimeout(function() {
+ strictEqual(count, 2);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(3);
QUnit.start();
- }, 64);
+ }
});
- test('should work with `leading` option', function() {
- _.forEach([true, { 'leading': true }], function(options) {
- var withLeading = _.throttle(_.identity, 32, options);
- equal(withLeading('x'), 'x');
- });
+ test('should work with `leading` option', 4, function() {
+ if (!(isRhino && isModularize)) {
+ _.forEach([true, { 'leading': true }], function(options) {
+ var withLeading = _.throttle(_.identity, 32, options);
+ equal(withLeading('x'), 'x');
+ });
- _.forEach([false, { 'leading': false }], function(options) {
- var withoutLeading = _.throttle(_.identity, 32, options);
- strictEqual(withoutLeading('x'), undefined);
- });
+ _.forEach([false, { 'leading': false }], function(options) {
+ var withoutLeading = _.throttle(_.identity, 32, options);
+ strictEqual(withoutLeading('x'), undefined);
+ });
+ }
+ else {
+ skipTest(4);
+ }
});
- asyncTest('should work with `trailing` option', function() {
- var withCount = 0,
- withoutCount = 0;
+ asyncTest('should work with `trailing` option', 6, function() {
+ if (!(isRhino && isModularize)) {
+ var withCount = 0,
+ withoutCount = 0;
- var withTrailing = _.throttle(function(value) {
- withCount++;
- return value;
- }, 32, { 'trailing': true });
+ var withTrailing = _.throttle(function(value) {
+ withCount++;
+ return value;
+ }, 32, { 'trailing': true });
- var withoutTrailing = _.throttle(function(value) {
- withoutCount++;
- return value;
- }, 32, { 'trailing': false });
+ var withoutTrailing = _.throttle(function(value) {
+ withoutCount++;
+ return value;
+ }, 32, { 'trailing': false });
- _.times(2, function() {
- equal(withTrailing('x'), 'x');
- equal(withoutTrailing('x'), 'x');
- });
+ _.times(2, function() {
+ equal(withTrailing('x'), 'x');
+ equal(withoutTrailing('x'), 'x');
+ });
- setTimeout(function() {
- equal(withCount, 2);
- strictEqual(withoutCount, 1);
+ setTimeout(function() {
+ equal(withCount, 2);
+ strictEqual(withoutCount, 1);
+ QUnit.start();
+ }, 64);
+ }
+ else {
+ skipTest(6);
QUnit.start();
- }, 64);
+ }
});
- asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', function() {
- var count = 0;
+ asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', 1, function() {
+ if (!(isRhino && isModularize)) {
+ var count = 0;
- var throttled = _.throttle(function() {
- count++;
- }, 64, { 'trailing': false });
+ var throttled = _.throttle(function() {
+ count++;
+ }, 64, { 'trailing': false });
- _.times(2, throttled);
- setTimeout(function() { _.times(2, throttled); }, 100);
+ _.times(2, throttled);
+ setTimeout(function() { _.times(2, throttled); }, 100);
- setTimeout(function() {
- equal(count, 2);
+ setTimeout(function() {
+ equal(count, 2);
+ QUnit.start();
+ }, 128);
+ }
+ else {
+ skipTest();
QUnit.start();
- }, 128);
+ }
});
}());
@@ -3960,7 +4071,7 @@
(function() {
var args = arguments;
- test('should return a dense array', function() {
+ test('should return a dense array', 3, function() {
var array = Array(3);
array[1] = 2;
@@ -3971,18 +4082,18 @@
deepEqual(actual, array);
});
- test('should treat array-like objects like arrays', function() {
+ test('should treat array-like objects like arrays', 2, function() {
var object = { '0': 'a', '1': 'b', '2': 'c', 'length': 3 };
deepEqual(_.toArray(object), ['a', 'b', 'c']);
deepEqual(_.toArray(args), [1, 2, 3]);
});
- test('should work with a string for `collection` (test in Opera < 10.52)', function() {
+ test('should work with a string for `collection` (test in Opera < 10.52)', 2, function() {
deepEqual(_.toArray('abc'), ['a', 'b', 'c']);
deepEqual(_.toArray(Object('abc')), ['a', 'b', 'c']);
});
- test('should work with a node list for `collection` (test in IE < 9)', function() {
+ test('should work with a node list for `collection` (test in IE < 9)', 1, function() {
if (document) {
try {
var nodeList = document.getElementsByTagName('body'),
@@ -4000,15 +4111,15 @@
QUnit.module('lodash.times');
(function() {
- test('should return an array of the results of each `callback` execution', function() {
+ test('should return an array of the results of each `callback` execution', 1, function() {
deepEqual(_.times(3, function(n) { return n * 2; }), [0, 2, 4]);
});
- test('should coerce `n` to a number', function() {
+ test('should coerce `n` to a number', 1, function() {
deepEqual(_.times(null), []);
});
- test('should not error on negative `n` values', function() {
+ test('should not error on negative `n` values', 1, function() {
var pass = true;
try {
_.times(-1);
@@ -4024,7 +4135,7 @@
QUnit.module('lodash.transform');
(function() {
- test('should produce an that is an instance of the given object\'s constructor', function() {
+ test('should produce an that is an instance of the given object\'s constructor', 2, function() {
function Foo() {
this.a = 1;
this.b = 2;
@@ -4039,7 +4150,7 @@
deepEqual(_.clone(actual), { 'a': 1, 'b': 4, 'c': 9 });
});
- test('should treat sparse arrays as dense', function() {
+ test('should treat sparse arrays as dense', 1, function() {
var actual = _.transform(Array(1), function(result, value, index) {
result[index] = String(value);
});
@@ -4052,7 +4163,7 @@
'object': { 'a': 1, 'b': 2, 'c': 3 }
},
function(object, key) {
- test('should pass the correct `callback` arguments when transforming an ' + key, function() {
+ test('should pass the correct `callback` arguments when transforming an ' + key, 2, function() {
var args;
_.transform(object, function() {
@@ -4069,7 +4180,7 @@
}
});
- test('should support the `thisArg` argument when transforming an ' + key, function() {
+ test('should support the `thisArg` argument when transforming an ' + key, 2, function() {
var actual = _.transform(object, function(result, value, key) {
result[key] = this[key];
}, null, object);
@@ -4088,19 +4199,19 @@
var escaped = '&<>"'\/',
unescaped = '&<>"\'\/';
- test('should unescape entities in the correct order', function() {
+ test('should unescape entities in the correct order', 1, function() {
equal(_.unescape('<'), '<');
});
- test('should unescape the proper entities', function() {
+ test('should unescape the proper entities', 1, function() {
equal(_.unescape(escaped), unescaped);
});
- test('should unescape the same characters escaped by `_.escape`', function() {
+ test('should unescape the same characters escaped by `_.escape`', 1, function() {
equal(_.unescape(_.escape(unescaped)), unescaped);
});
- test('should return an empty string when provided `null` or `undefined`', function() {
+ test('should return an empty string when provided `null` or `undefined`', 2, function() {
equal(_.unescape(null), '');
equal(_.unescape(undefined), '');
});
@@ -4111,14 +4222,14 @@
QUnit.module('lodash.union');
(function() {
- test('should produce correct results when provided a falsey `array` argument', function() {
+ test('should produce correct results when provided a falsey `array` argument', 1, function() {
var expected = [1, 2, 3],
actual = _.union(null, expected);
deepEqual(actual, expected);
});
- test('should not accept individual secondary values', function() {
+ test('should not accept individual secondary values', 1, function() {
deepEqual(_.union([1], 1, 2, 3), [1]);
});
}());
@@ -4128,7 +4239,7 @@
QUnit.module('lodash.uniq');
(function() {
- test('should support the `thisArg` argument', function() {
+ test('should support the `thisArg` argument', 1, function() {
var actual = _.uniq([1, 2, 1.5, 3, 2.5], function(num) {
return this.floor(num);
}, Math);
@@ -4136,14 +4247,14 @@
deepEqual(actual, [1, 2, 3]);
});
- test('should perform an unsorted uniq operation when used as `callback` for `_.map`', function() {
+ test('should perform an unsorted uniq operation when used as `callback` for `_.map`', 1, function() {
var array = [[2, 1, 2], [1, 2, 1]],
actual = _.map(array, _.uniq);
deepEqual(actual, [[2, 1], [1, 2]]);
});
- test('should work with large arrays of boolean, `null`, and `undefined` values', function() {
+ test('should work with large arrays of boolean, `null`, and `undefined` values', 1, function() {
var array = [],
expected = [true, false, null, undefined],
count = Math.ceil(largeArraySize / expected.length);
@@ -4154,7 +4265,7 @@
deepEqual(_.uniq(array), expected);
});
- test('should distinguish between numbers and numeric strings', function() {
+ test('should distinguish between numbers and numeric strings', 1, function() {
var array = [],
expected = ['2', 2, Object('2'), Object(2)],
count = Math.ceil(largeArraySize / expected.length);
@@ -4172,7 +4283,7 @@
'a string': '0'
},
function(callback, key) {
- test('should work with ' + key + ' for `callback`', function() {
+ test('should work with ' + key + ' for `callback`', 1, function() {
var actual = _.uniq([['a'], ['b'], ['a']], callback);
deepEqual(actual, [['a'], ['b']]);
});
@@ -4184,11 +4295,11 @@
QUnit.module('lodash.uniqueId');
(function() {
- test('should return a string value when not passing a prefix argument', function() {
+ test('should return a string value when not passing a prefix argument', 1, function() {
equal(typeof _.uniqueId(), 'string');
});
- test('should coerce the prefix argument to a string', function() {
+ test('should coerce the prefix argument to a string', 1, function() {
var actual = [_.uniqueId(3), _.uniqueId(2), _.uniqueId(1)];
ok(/3\d+,2\d+,1\d+/.test(actual));
});
@@ -4207,7 +4318,7 @@
{ 'a': 3 }
];
- test('should filter by properties', function() {
+ test('should filter by properties', 6, function() {
deepEqual(_.where(array, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }]);
deepEqual(_.where(array, { 'a': 2 }), [{ 'a': 2, 'b': 2 }]);
deepEqual(_.where(array, { 'a': 3 }), [{ 'a': 3 }]);
@@ -4216,7 +4327,7 @@
deepEqual(_.where(array, { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }]);
});
- test('should not filter by inherited properties', function() {
+ test('should not filter by inherited properties', 1, function() {
function Foo() {}
Foo.prototype = { 'a': 2 };
@@ -4225,12 +4336,12 @@
deepEqual(_.where(array, properties), [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }]);
});
- test('should filter by problem JScript properties (test in IE < 9)', function() {
+ test('should filter by problem JScript properties (test in IE < 9)', 1, function() {
var collection = [shadowedObject];
deepEqual(_.where(collection, shadowedObject), [shadowedObject]);
});
- test('should work with an object for `collection`', function() {
+ test('should work with an object for `collection`', 1, function() {
var collection = {
'x': { 'a': 1 },
'y': { 'a': 3 },
@@ -4240,18 +4351,18 @@
deepEqual(_.where(collection, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1, 'b': 2 }]);
});
- test('should return an empty array when provided an empty `properties` object', function() {
+ test('should return an empty array when provided an empty `properties` object', 1, function() {
deepEqual(_.where(array, {}), []);
});
- test('should deep compare `properties` values', function() {
+ test('should deep compare `properties` values', 1, function() {
var collection = [{ 'a': { 'b': { 'c': 1, 'd': 2 }, 'e': 3 }, 'f': 4 }],
expected = _.cloneDeep(collection);
deepEqual(_.where(collection, { 'a': { 'b': { 'c': 1 } } }), expected);
});
- test('should search of arrays for values', function() {
+ test('should search of arrays for values', 2, function() {
var collection = [{ 'a': [1, 2] }],
expected = _.cloneDeep(collection);
@@ -4285,14 +4396,14 @@
};
_.forOwn(object, function(pair, key) {
- test('should work with ' + key, function() {
+ test('should work with ' + key, 2, function() {
var actual = _.zip.apply(_, pair[0]);
deepEqual(actual, pair[1]);
deepEqual(_.zip.apply(_, actual), actual.length ? pair[0] : []);
});
});
- test('should work with tuples of different lengths', function() {
+ test('should work with tuples of different lengths', 4, function() {
var pair = [
[['moe', 30], ['larry', 40, false]],
[['moe', 'larry'], [30, 40], [undefined, false]]
@@ -4307,7 +4418,7 @@
deepEqual(actual, [['moe', 30, undefined], ['larry', 40, false]]);
});
- test('should correctly consume it\'s output', function() {
+ test('should correctly consume it\'s output', 1, function() {
var expected = [['moe', 'larry'], [30, 40]];
deepEqual(_.zip(_.zip(_.zip(_.zip(expected)))), expected);
});
@@ -4318,7 +4429,7 @@
QUnit.module('lodash.zipObject');
(function() {
- test('should skip falsey elements in a given two dimensional array', function() {
+ test('should skip falsey elements in a given two dimensional array', 1, function() {
var actual = _.zipObject([['a', 1], ['b', 2]].concat(falsey));
deepEqual(actual, { 'a': 1, 'b': 2 });
});
@@ -4329,7 +4440,7 @@
QUnit.module('lodash(...).shift');
(function() {
- test('should remove the value at index `0` when length is `0` (test in IE 8 compatibility mode)', function() {
+ test('should remove the value at index `0` when length is `0` (test in IE 8 compatibility mode)', 2, function() {
var wrapped = _({ '0': 1, 'length': 1 });
wrapped.shift();
@@ -4343,7 +4454,7 @@
QUnit.module('lodash(...).splice');
(function() {
- test('should remove the value at index `0` when length is `0` (test in IE < 9, and in compatibility mode for IE9)', function() {
+ test('should remove the value at index `0` when length is `0` (test in IE < 9, and in compatibility mode for IE9)', 2, function() {
var wrapped = _({ '0': 1, 'length': 1 });
wrapped.splice(0, 1);
@@ -4357,7 +4468,7 @@
QUnit.module('lodash(...).toString');
(function() {
- test('should return the `toString` result of the wrapped value', function() {
+ test('should return the `toString` result of the wrapped value', 1, function() {
var wrapped = _([1, 2, 3]);
equal(String(wrapped), '1,2,3');
});
@@ -4368,7 +4479,7 @@
QUnit.module('lodash(...).valueOf');
(function() {
- test('should return the `valueOf` result of the wrapped value', function() {
+ test('should return the `valueOf` result of the wrapped value', 1, function() {
var wrapped = _(123);
equal(Number(wrapped), 123);
});
@@ -4388,7 +4499,7 @@
];
_.forEach(funcs, function(methodName) {
- test('`_.' + methodName + '` should return a wrapped value', function() {
+ test('`_.' + methodName + '` should return a wrapped value', 1, function() {
ok(wrapped[methodName]() instanceof _);
});
});
@@ -4436,7 +4547,7 @@
];
_.forEach(funcs, function(methodName) {
- test('`_(...).' + methodName + '` should return an unwrapped value', function() {
+ test('`_(...).' + methodName + '` should return an unwrapped value', 1, function() {
var result = methodName == 'reduceRight'
? wrapped[methodName](_.identity)
: wrapped[methodName]();
@@ -4461,15 +4572,15 @@
];
_.forEach(funcs, function(methodName) {
- test('`_(...).' + methodName + '` called without an `n` argument should return an unwrapped value', function() {
+ test('`_(...).' + methodName + '` called without an `n` argument should return an unwrapped value', 1, function() {
equal(typeof wrapped[methodName](), 'number');
});
- test('`_(...).' + methodName + '` called with an `n` argument should return a wrapped value', function() {
+ test('`_(...).' + methodName + '` called with an `n` argument should return a wrapped value', 1, function() {
ok(wrapped[methodName](1) instanceof _);
});
- test('`_.' + methodName + '` should return `undefined` when querying falsey arguments without an `n` argument', function() {
+ test('`_.' + methodName + '` should return `undefined` when querying falsey arguments without an `n` argument', 1, function() {
var actual = [],
expected = _.map(falsey, function() { return undefined; }),
func = _[methodName];
@@ -4483,7 +4594,7 @@
deepEqual(actual, expected);
});
- test('`_.' + methodName + '` should return an empty array when querying falsey arguments with an `n` argument', function() {
+ test('`_.' + methodName + '` should return an empty array when querying falsey arguments with an `n` argument', 1, function() {
var actual = [],
expected = _.map(falsey, function() { return []; }),
func = _[methodName];
@@ -4507,7 +4618,7 @@
var args = arguments,
array = [1, 2, 3, 4, 5, 6];
- test('should work with `arguments` objects', function() {
+ test('should work with `arguments` objects', 23, function() {
function message(methodName) {
return '`_.' + methodName + '` should work with `arguments` objects';
}
@@ -4544,7 +4655,7 @@
ok(args.length == 1 && _.isEqual(args[0], [3]), message('remove'));
});
- test('should accept falsey primary arguments', function() {
+ test('should accept falsey primary arguments', 3, function() {
function message(methodName) {
return '`_.' + methodName + '` should accept falsey primary arguments';
}
@@ -4554,7 +4665,7 @@
deepEqual(_.union(null, array), array, message('union'));
});
- test('should accept falsey secondary arguments', function() {
+ test('should accept falsey secondary arguments', 3, function() {
function message(methodName) {
return '`_.' + methodName + '` should accept falsey secondary arguments';
}
@@ -4622,7 +4733,7 @@
var acceptFalsey = _.difference(allMethods, rejectFalsey);
- test('should accept falsey arguments', function() {
+ test('should accept falsey arguments', 147, function() {
var isExported = '_' in root,
oldDash = root._;
@@ -4655,12 +4766,12 @@
});
// add a skipped test for `_.runInContext` which is abscent from modularized builds
- if (isModularize) {
+ if (!_.runInContext) {
skipTest();
}
});
- test('should reject falsey arguments', function() {
+ test('should reject falsey arguments', 14, function() {
_.forEach(rejectFalsey, function(methodName) {
var actual = [],
expected = _.map(falsey, function() { return true; }),
@@ -4680,7 +4791,7 @@
});
});
- test('should handle `null` `thisArg` arguments', function() {
+ test('should handle `null` `thisArg` arguments', 30, function() {
var thisArg,
callback = function() { thisArg = this; },
expected = (function() { return this; }).call(null);
diff --git a/vendor/docdown/src/DocDown/MarkdownGenerator.php b/vendor/docdown/src/DocDown/MarkdownGenerator.php
index 16ceb1198c..0cd0de247d 100644
--- a/vendor/docdown/src/DocDown/MarkdownGenerator.php
+++ b/vendor/docdown/src/DocDown/MarkdownGenerator.php
@@ -195,7 +195,7 @@ private function addEntries( &$result, $entries ) {
if (count($aliases = $entry->getAliases())) {
array_push($result, '', '#### Aliases');
foreach ($aliases as $index => $alias) {
- $aliases[$index] = $alias->getName();
+ $aliases[$index] = MarkdownGenerator::interpolate('#{member}#{separator}#{name}', $alias);
}
$result[] = '*' . implode(', ', $aliases) . '*';
}
diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js
index df70255382..f43ff6c042 100644
--- a/vendor/qunit-clib/qunit-clib.js
+++ b/vendor/qunit-clib/qunit-clib.js
@@ -108,14 +108,48 @@
/*------------------------------------------------------------------------*/
+ /** Used to report the test module for failing tests */
+ var moduleName,
+ modulePrinted;
+
/** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
var console = context.console || (context.console = { 'log': context.print });
+ /** Used as a horizontal rule in console output */
+ var hr = '----------------------------------------';
+
+ /** Used by `logInline` to clear previously logged messages */
+ var prevLine = '';
+
/** Shorten `context.QUnit.QUnit` to `context.QUnit` */
var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit;
- /** Used as a horizontal rule in console output */
- var hr = '----------------------------------------';
+ /**
+ * Logs an inline message to standard output.
+ *
+ * @private
+ * @param {string} text The text to log.
+ */
+ var logInline = (function() {
+ // exit early if not Node.js
+ if (!(typeof process == 'object' && process &&
+ process.on && process.stdout && process.platform != 'win32')) {
+ return function() {};
+ }
+ // cleanup any inline logs when exited via `ctrl+c`
+ process.on('SIGINT', function() {
+ logInline('');
+ process.exit();
+ });
+ return function(text) {
+ var blankLine = Array(prevLine.length + 1).join(' ');
+ if (text.length > hr.length) {
+ text = text.slice(0, hr.length - 3) + '...';
+ }
+ prevLine = text;
+ process.stdout.write(text + blankLine.slice(text.length) + '\r');
+ }
+ }());
/**
* A logging callback triggered when all testing is completed.
@@ -133,12 +167,13 @@
}
ran = true;
+ logInline('');
console.log(hr);
console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total);
console.log(' Finished in ' + details.runtime + ' milliseconds.');
console.log(hr);
- // exit out of Narhwal, Rhino, or Ringo
+ // exit out of Narhwal, Rhino, or RingoJS
try {
quit();
} catch(e) { }
@@ -186,9 +221,11 @@
* @param {Object} details An object with property `name`.
*/
QUnit.moduleStart(function(details) {
- console.log(hr);
- console.log(details.name);
- console.log(hr);
+ var newModuleName = details.name;
+ if (moduleName != newModuleName) {
+ moduleName = newModuleName;
+ modulePrinted = false;
+ }
});
/**
@@ -224,13 +261,19 @@
testName = details.name;
if (details.failed > 0) {
+ logInline('');
+ if (!modulePrinted) {
+ modulePrinted = true;
+ console.log(hr);
+ console.log(moduleName);
+ console.log(hr);
+ }
console.log(' FAIL - '+ testName);
assertions.forEach(function(value) {
console.log(' ' + value);
});
- }
- else {
- console.log(' PASS - ' + testName);
+ } else {
+ logInline('Testing ' + moduleName + '...');
}
assertions.length = 0;
});
@@ -244,7 +287,7 @@
QUnit.config.testStats = {
/**
- * An array of test summaries (pipe separated).
+ * An array of test summaries.
*
* @memberOf QUnit.config.testStats
* @type Array