parent
4159a65ea2
commit
d5195b5d59
1 changed files with 17 additions and 1 deletions
|
@ -44,4 +44,20 @@ describe("throttle(f, 1000)", function() {
|
||||||
this.clock.restore();
|
this.clock.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('throttle', () => {
|
||||||
|
|
||||||
|
it('runs a forwarded call once', done => {
|
||||||
|
let log = '';
|
||||||
|
const f = str => log += str;
|
||||||
|
const f10 = throttle(f, 10);
|
||||||
|
f10('once');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
assert.equal(log, 'once');
|
||||||
|
done();
|
||||||
|
}, 20);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue