Merge "Hygiene: Use promises A/A+ everywhere"

This commit is contained in:
jenkins-bot 2017-08-22 14:34:26 +00:00 committed by Gerrit Code Review
commit 8bb322b15d
4 changed files with 15 additions and 13 deletions

View file

@ -176,7 +176,7 @@ QUnit.test( 'MediaWiki API gateway returns the correct data ', function ( assert
},
gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS );
return gateway.getPageSummary( 'Test Title' ).done( function ( result ) {
return gateway.getPageSummary( 'Test Title' ).then( function ( result ) {
assert.deepEqual( result, MEDIAWIKI_API_RESPONSE_PREVIEW_MODEL );
} );
} );
@ -213,7 +213,7 @@ QUnit.test( 'MediaWiki API gateway handles missing pages ', function ( assert )
},
gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS );
return gateway.getPageSummary( 'Test Title' ).done( function ( result ) {
return gateway.getPageSummary( 'Test Title' ).then( function ( result ) {
assert.deepEqual( result, model );
} );
} );

View file

@ -244,7 +244,7 @@ QUnit.test( 'RESTBase gateway does not treat a 404 as a failure', function ( ass
api = this.sandbox.stub().returns( deferred.reject( { status: 404 } ).promise() ),
gateway = createRESTBaseGateway( api, { THUMBNAIL_SIZE: 200 }, provideParsedExtract );
return gateway.getPageSummary( 'Test Title' ).done( function () {
return gateway.getPageSummary( 'Test Title' ).then( function () {
assert.ok( true );
} );
} );
@ -255,7 +255,7 @@ QUnit.test( 'RESTBase gateway returns the correct data ', function ( assert ) {
),
gateway = createRESTBaseGateway( api, DEFAULT_CONSTANTS, provideParsedExtract );
return gateway.getPageSummary( 'Test Title' ).done( function ( result ) {
return gateway.getPageSummary( 'Test Title' ).then( function ( result ) {
assert.deepEqual( result, RESTBASE_RESPONSE_PREVIEW_MODEL );
} );
} );

View file

@ -280,11 +280,11 @@ QUnit.test( 'show', function ( assert ) {
behavior = createBehavior( this.sandbox ),
token = 'some-token',
$container = $( '<div>' ),
promise;
showPreview;
preview.el.show = this.sandbox.stub();
promise = renderer.show(
showPreview = renderer.show(
preview, event, link, behavior, token, $container.get( 0 ) );
assert.notEqual(
@ -297,7 +297,7 @@ QUnit.test( 'show', function ( assert ) {
'Preview has been shown.'
);
return promise.done( function () {
return showPreview.then( function () {
assert.ok(
behavior.previewShow.calledWith( token ),
'previewShow has been called with the correct token.'
@ -313,7 +313,7 @@ QUnit.test( 'hide - fade out up', function ( assert ) {
isTall: false
},
$container = $( '<div>' ).append( preview.el ),
promise = renderer.hide( preview );
hidePreview = renderer.hide( preview );
assert.ok(
preview.el.hasClass( 'mwe-popups-fade-out-up' ),
@ -328,7 +328,7 @@ QUnit.test( 'hide - fade out up', function ( assert ) {
'',
'Preview is still in the container.'
);
return promise.done( function () {
return hidePreview.then( function () {
assert.equal(
$container.html(),
'',
@ -345,7 +345,7 @@ QUnit.test( 'hide - fade out down', function ( assert ) {
isTall: false
},
$container = $( '<div>' ).append( preview.el ),
promise = renderer.hide( preview );
hidePreview = renderer.hide( preview );
assert.ok(
preview.el.hasClass( 'mwe-popups-fade-out-down' ),
@ -360,7 +360,7 @@ QUnit.test( 'hide - fade out down', function ( assert ) {
'',
'Preview is still in the container.'
);
return promise.done( function () {
return hidePreview.then( function () {
assert.equal(
$container.html(),
'',

View file

@ -11,13 +11,15 @@ QUnit.test( 'it should resolve after waiting', function ( assert ) {
callback();
} );
return wait( 150 ).done( function () {
return wait( 150 ).then( function () {
assert.strictEqual(
timeout.getCall( 0 ).args[ 1 ],
150,
'It waits for the given duration'
);
} ).always( function () {
timeout.restore();
} ).catch( function ( err ) {
timeout.restore();
throw err;
} );
} );