mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-25 13:32:53 +00:00
24 lines
458 B
JavaScript
24 lines
458 B
JavaScript
|
( function ( mw ) {
|
||
|
|
||
|
QUnit.module( 'ext.popups/wait' );
|
||
|
|
||
|
QUnit.test( 'it should resolve after waiting', function ( assert ) {
|
||
|
var done = assert.async();
|
||
|
|
||
|
this.sandbox.stub( window, 'setTimeout', function ( callback ) {
|
||
|
callback();
|
||
|
} );
|
||
|
|
||
|
mw.popups.wait( 150 ).done( function () {
|
||
|
assert.strictEqual(
|
||
|
window.setTimeout.getCall( 0 ).args[ 1 ],
|
||
|
150,
|
||
|
'It waits for the given duration'
|
||
|
);
|
||
|
|
||
|
done();
|
||
|
} );
|
||
|
} );
|
||
|
|
||
|
}( mediaWiki ) );
|