diff --git a/vendor/benchmark.js/benchmark.js b/vendor/benchmark.js/benchmark.js index cb22503df..48dab5a6f 100644 --- a/vendor/benchmark.js/benchmark.js +++ b/vendor/benchmark.js/benchmark.js @@ -118,7 +118,7 @@ // Avoid issues with some ES3 environments that attempt to use values, named // after built-in constructors like `Object`, for the creation of literals. // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.com/#x11.1.5. + // See http://es5.github.io/#x11.1.5. context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window; /** Native constructor references */ @@ -131,8 +131,8 @@ String = context.String; /** Used for `Array` and `Object` method references */ - var arrayRef = Array(), - objectRef = Object(); + var arrayRef = [], + objectProto = Object.prototype; /** Native method shortcuts */ var abs = Math.abs, @@ -147,7 +147,7 @@ shift = arrayRef.shift, slice = arrayRef.slice, sqrt = Math.sqrt, - toString = objectRef.toString; + toString = objectProto.toString; /** Detect DOM document object */ var doc = isHostType(context, 'document') && context.document; @@ -704,20 +704,20 @@ * A helper function for setting options/event handlers. * * @private - * @param {Object} bench The benchmark instance. + * @param {Object} object The benchmark or suite instance. * @param {Object} [options={}] Options object. */ - function setOptions(bench, options) { - options = _.extend({}, bench.constructor.options, options); - bench.options = _.forOwn(options, function(value, key) { + function setOptions(object, options) { + options = _.extend({}, object.constructor.options, options); + object.options = _.forOwn(options, function(value, key) { if (value != null) { // add event listeners if (/^on[A-Z]/.test(key)) { _.each(key.split(' '), function(key) { - bench.on(key.slice(2).toLowerCase(), value); + object.on(key.slice(2).toLowerCase(), value); }); - } else if (!_.has(bench, key)) { - bench[key] = cloneDeep(value); + } else if (!_.has(object, key)) { + object[key] = cloneDeep(value); } } }); diff --git a/vendor/underscore/test/arrays.js b/vendor/underscore/test/arrays.js index 97fdb8779..3306581ad 100644 --- a/vendor/underscore/test/arrays.js +++ b/vendor/underscore/test/arrays.js @@ -107,6 +107,8 @@ $(document).ready(function() { equal(_(stooges).intersection(leaders).join(''), 'moe', 'can perform an OO-style intersection'); var result = (function(){ return _.intersection(arguments, leaders); })('moe', 'curly', 'larry'); equal(result.join(''), 'moe', 'works on an arguments object'); + var theSixStooges = ['moe', 'moe', 'curly', 'curly', 'larry', 'larry']; + equal(_.intersection(theSixStooges, leaders).join(''), 'moe', 'returns a duplicate-free array'); }); test("union", function() { diff --git a/vendor/underscore/test/collections.js b/vendor/underscore/test/collections.js index 230b08fa2..f8796db14 100644 --- a/vendor/underscore/test/collections.js +++ b/vendor/underscore/test/collections.js @@ -274,6 +274,12 @@ $(document).ready(function() { deepEqual(result, {a: 1, b: 2}); result = _.findWhere(list, {b: 4}); deepEqual(result, {a: 1, b: 4}); + + result = _.findWhere(list, {c:1}) + ok(_.isUndefined(result), "undefined when not found"); + + result = _.findWhere([], {c:1}); + ok(_.isUndefined(result), "undefined when searching empty list"); }); test('max', function() { diff --git a/vendor/underscore/test/functions.js b/vendor/underscore/test/functions.js index 90843afa1..1199038eb 100644 --- a/vendor/underscore/test/functions.js +++ b/vendor/underscore/test/functions.js @@ -159,14 +159,14 @@ $(document).ready(function() { asyncTest("throttle repeatedly with results", 6, function() { var counter = 0; var incr = function(){ return ++counter; }; - var throttledIncr = _.throttle(incr, 64); + var throttledIncr = _.throttle(incr, 100); var results = []; var saveResult = function() { results.push(throttledIncr()); }; saveResult(); saveResult(); - _.delay(saveResult, 32); - _.delay(saveResult, 80); - _.delay(saveResult, 96); - _.delay(saveResult, 144); + _.delay(saveResult, 50); + _.delay(saveResult, 150); + _.delay(saveResult, 160); + _.delay(saveResult, 230); _.delay(function() { equal(results[0], 1, "incr was called once"); equal(results[1], 1, "incr was throttled"); @@ -175,7 +175,7 @@ $(document).ready(function() { equal(results[4], 2, "incr was throttled"); equal(results[5], 3, "incr was called trailing"); start(); - }, 192); + }, 300); }); asyncTest("throttle triggers trailing call when invoked repeatedly", 2, function() {