mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 19:50:04 +00:00
f4d04b95b6
Fixes tests for sinon v4, which is a dependency of mw-node-qunit v3. Bug: T180255 Change-Id: I8c7b703f81140e06546aa954f98b8766f5225ff5
26 lines
531 B
JavaScript
26 lines
531 B
JavaScript
import wait from '../../src/wait';
|
|
|
|
QUnit.module( 'ext.popups/wait' );
|
|
|
|
QUnit.test( 'it should resolve after waiting', function ( assert ) {
|
|
var timeout;
|
|
|
|
assert.expect( 1 );
|
|
|
|
timeout = this.sandbox.stub( global, 'setTimeout' ).callsFake( function ( callback ) {
|
|
callback();
|
|
} );
|
|
|
|
return wait( 150 ).then( function () {
|
|
assert.strictEqual(
|
|
timeout.getCall( 0 ).args[ 1 ],
|
|
150,
|
|
'It waits for the given duration'
|
|
);
|
|
timeout.restore();
|
|
} ).catch( function ( err ) {
|
|
timeout.restore();
|
|
throw err;
|
|
} );
|
|
} );
|