mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-17 20:41:32 +00:00
0bee0906d4
eslint \ --cache \ --max-warnings 0 \ --report-unused-disable-directives \ --fix \ src tests Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
26 lines
513 B
JavaScript
26 lines
513 B
JavaScript
import wait from '../../src/wait';
|
|
|
|
QUnit.module( 'ext.popups/wait' );
|
|
|
|
QUnit.test( 'it should resolve after waiting', function ( assert ) {
|
|
let timeout;
|
|
|
|
assert.expect( 1 );
|
|
|
|
timeout = this.sandbox.stub( global, 'setTimeout' ).callsFake( ( callback ) => {
|
|
callback();
|
|
} );
|
|
|
|
return wait( 150 ).then( () => {
|
|
assert.strictEqual(
|
|
timeout.getCall( 0 ).args[ 1 ],
|
|
150,
|
|
'It waits for the given duration'
|
|
);
|
|
timeout.restore();
|
|
} ).catch( ( err ) => {
|
|
timeout.restore();
|
|
throw err;
|
|
} );
|
|
} );
|