mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-14 19:25:33 +00:00
4d8364a999
Remove usages of deprecated methods like .done which make jquery promises fall back to non-standard behavior Additional changes: * Rename var promise to a more descriptive name in tests Bug: T173819 Change-Id: I7b041d0a7a8c42a8eac947295d265e898085c60a
26 lines
519 B
JavaScript
26 lines
519 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', 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;
|
|
} );
|
|
} );
|