mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-28 09:20:31 +00:00
27 lines
488 B
JavaScript
27 lines
488 B
JavaScript
|
var wait = require( '../../src/wait' );
|
||
|
|
||
|
QUnit.module( 'ext.popups/wait' );
|
||
|
|
||
|
QUnit.test( 'it should resolve after waiting', function ( assert ) {
|
||
|
var done = assert.async(),
|
||
|
timeout;
|
||
|
|
||
|
assert.expect( 1 );
|
||
|
|
||
|
timeout = this.sandbox.stub( global, 'setTimeout', function ( callback ) {
|
||
|
callback();
|
||
|
} );
|
||
|
|
||
|
wait( 150 ).done( function () {
|
||
|
assert.strictEqual(
|
||
|
timeout.getCall( 0 ).args[ 1 ],
|
||
|
150,
|
||
|
'It waits for the given duration'
|
||
|
);
|
||
|
|
||
|
done();
|
||
|
} );
|
||
|
|
||
|
timeout.restore();
|
||
|
} );
|