import popper.js
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
615dc56d16
commit
16fb2bb919
241 changed files with 34099 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
import { microtaskDebounce, taskDebounce } from '../../src/utils/debounce';
|
||||
const microTasksAvailable = window.Promise
|
||||
|
||||
describe('utils/debounce', () => {
|
||||
it('microtaskDebounce: should be called only once', done => {
|
||||
if (!microTasksAvailable) {
|
||||
pending();
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
const debounced = microtaskDebounce(() => i++);
|
||||
debounced();
|
||||
debounced();
|
||||
debounced();
|
||||
setTimeout(() => {
|
||||
expect(i).toBe(1, 'debounce is called only once');
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
|
||||
it('taskDebounce: should be called only once', done => {
|
||||
let i = 0;
|
||||
const debounced = taskDebounce(() => i++);
|
||||
debounced();
|
||||
debounced();
|
||||
debounced();
|
||||
setTimeout(() => {
|
||||
expect(i).toBe(1, 'debounce is called only once');
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue