mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-18 12:55:51 +00:00
30550e2670
Don't use fake timers for now because of some problems with other async tests. Change-Id: If48a8c7390416938d50c9c0c39539fe4a6a9a6af
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();
|
|
} );
|