mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Adjust _.throttle timing in test/test.js.
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -1475,12 +1475,12 @@
|
|||||||
var withTrailing = _.debounce(function(value) {
|
var withTrailing = _.debounce(function(value) {
|
||||||
withCount++;
|
withCount++;
|
||||||
return value;
|
return value;
|
||||||
}, 32, { 'trailing': true });
|
}, 64, { 'trailing': true });
|
||||||
|
|
||||||
var withoutTrailing = _.debounce(function(value) {
|
var withoutTrailing = _.debounce(function(value) {
|
||||||
withoutCount++;
|
withoutCount++;
|
||||||
return value;
|
return value;
|
||||||
}, 32, { 'trailing': false });
|
}, 64, { 'trailing': false });
|
||||||
|
|
||||||
strictEqual(withTrailing('x'), undefined);
|
strictEqual(withTrailing('x'), undefined);
|
||||||
strictEqual(withoutTrailing('x'), undefined);
|
strictEqual(withoutTrailing('x'), undefined);
|
||||||
@@ -1499,17 +1499,17 @@
|
|||||||
|
|
||||||
test('should work with `maxWait` option', 2, function() {
|
test('should work with `maxWait` option', 2, function() {
|
||||||
if (!(isRhino && isModularize)) {
|
if (!(isRhino && isModularize)) {
|
||||||
var limit = 256,
|
var limit = 512,
|
||||||
withCount = 0,
|
withCount = 0,
|
||||||
withoutCount = 0;
|
withoutCount = 0;
|
||||||
|
|
||||||
var withMaxWait = _.debounce(function() {
|
var withMaxWait = _.debounce(function() {
|
||||||
withCount++;
|
withCount++;
|
||||||
}, 32, { 'maxWait': 64 });
|
}, 64, { 'maxWait': 128 });
|
||||||
|
|
||||||
var withoutMaxWait = _.debounce(function() {
|
var withoutMaxWait = _.debounce(function() {
|
||||||
withoutCount++;
|
withoutCount++;
|
||||||
}, 32);
|
}, 64);
|
||||||
|
|
||||||
var start = +new Date;
|
var start = +new Date;
|
||||||
while ((new Date - start) < limit) {
|
while ((new Date - start) < limit) {
|
||||||
@@ -7003,12 +7003,12 @@
|
|||||||
var withTrailing = _.throttle(function(value) {
|
var withTrailing = _.throttle(function(value) {
|
||||||
withCount++;
|
withCount++;
|
||||||
return value;
|
return value;
|
||||||
}, 32, { 'trailing': true });
|
}, 64, { 'trailing': true });
|
||||||
|
|
||||||
var withoutTrailing = _.throttle(function(value) {
|
var withoutTrailing = _.throttle(function(value) {
|
||||||
withoutCount++;
|
withoutCount++;
|
||||||
return value;
|
return value;
|
||||||
}, 32, { 'trailing': false });
|
}, 64, { 'trailing': false });
|
||||||
|
|
||||||
equal(withTrailing('x'), 'x');
|
equal(withTrailing('x'), 'x');
|
||||||
equal(withTrailing('y'), 'x');
|
equal(withTrailing('y'), 'x');
|
||||||
|
|||||||
Reference in New Issue
Block a user