( function ( mw, $ ) {
QUnit.module( 'mediawiki.api.upload', QUnit.newMwEnvironment( {} ) );
- QUnit.test( 'Basic functionality', function ( assert ) {
- QUnit.expect( 2 );
+ QUnit.test( 'Basic functionality', 2, function ( assert ) {
var api = new mw.Api();
assert.ok( api.upload );
- // The below will return a rejected deferred, but that's OK.
- assert.ok( api.upload() );
+ assert.throws( function () {
+ api.upload();
+ } );
} );
- QUnit.test( 'Set up iframe upload', function ( assert ) {
- QUnit.expect( 5 );
+ QUnit.test( 'Set up iframe upload', 5, function ( assert ) {
var $iframe, $form, $input,
api = new mw.Api();
return $.Deferred().promise();
} );
- api.uploadWithIframe( $( '<input>' )[0], { filename: 'Testing API upload.jpg' } );
+ api.uploadWithIframe( $( '<input>' )[ 0 ], { filename: 'Testing API upload.jpg' } );
$iframe = $( 'iframe' );
$form = $( 'form.mw-api-upload-form' );