diff --git a/test/test.js b/test/test.js index 14cfc8e88..ac7568e65 100644 --- a/test/test.js +++ b/test/test.js @@ -1682,6 +1682,27 @@ QUnit.start(); } }); + + asyncTest('should be cancelable', 1, function() { + if (!(isRhino && isModularize)) { + var pass = true; + + var timerId = _.defer(function() { + pass = false; + }); + + clearTimeout(timerId); + + setTimeout(function() { + ok(pass); + QUnit.start(); + }, 128); + } + else { + skipTest(); + QUnit.start(); + } + }); }()); /*--------------------------------------------------------------------------*/ @@ -1727,6 +1748,27 @@ QUnit.start(); } }); + + asyncTest('should be cancelable', 1, function() { + if (!(isRhino && isModularize)) { + var pass = true; + + var timerId = _.delay(function() { + pass = false; + }, 32); + + clearTimeout(timerId); + + setTimeout(function() { + ok(pass); + QUnit.start(); + }, 128); + } + else { + skipTest(); + QUnit.start(); + } + }); }()); /*--------------------------------------------------------------------------*/ @@ -7945,7 +7987,34 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash(...) methods that return wrapped values'); + QUnit.module('lodash(...) methods that return existing wrapped values'); + + (function() { + var array = [1, 2, 3], + wrapped = _(array); + + var funcs = [ + 'push', + 'reverse', + 'sort', + 'unshift' + ]; + + _.forEach(funcs, function(methodName) { + test('`_(...).' + methodName + '` should return the existing wrapped value', 1, function() { + if (!isNpm) { + strictEqual(wrapped[methodName](), wrapped); + } + else { + skipTest(); + } + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash(...) methods that return new wrapped values'); (function() { var array = [1, 2, 3], @@ -7953,11 +8022,12 @@ var funcs = [ 'concat', + 'slice', 'splice' ]; _.forEach(funcs, function(methodName) { - test('`_.' + methodName + '` should return a wrapped value', 1, function() { + test('`_(...).' + methodName + '` should return a new wrapped value', 1, function() { if (!isNpm) { ok(wrapped[methodName]() instanceof _); }