X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki.api%2Fmediawiki.api.upload.test.js;h=f4d4b287bd06ccbbd566d813c13786c2ee83fef8;hp=b1bd12ba17139848fbe754f158cffa327815d830;hb=fe94275c8fcfc248a5eae857dde7c5772d993ab5;hpb=3a2853e218acb586a00f2e59638de4176aee287f diff --git a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js index b1bd12ba17..f4d4b287bd 100644 --- a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js +++ b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.upload.test.js @@ -1,7 +1,7 @@ -( function ( mw, $ ) { +( function () { QUnit.module( 'mediawiki.api.upload', QUnit.newMwEnvironment( {} ) ); - QUnit.test( 'Basic functionality', 2, function ( assert ) { + QUnit.test( 'Basic functionality', function ( assert ) { var api = new mw.Api(); assert.ok( api.upload ); assert.throws( function () { @@ -9,7 +9,7 @@ } ); } ); - QUnit.test( 'Set up iframe upload', 5, function ( assert ) { + QUnit.test( 'Set up iframe upload', function ( assert ) { var $iframe, $form, $input, api = new mw.Api(); @@ -19,15 +19,15 @@ api.uploadWithIframe( $( '' )[ 0 ], { filename: 'Testing API upload.jpg' } ); - $iframe = $( 'iframe' ); + $iframe = $( 'iframe:last-child' ); $form = $( 'form.mw-api-upload-form' ); $input = $form.find( 'input[name=filename]' ); - assert.ok( $form.length > 0 ); - assert.ok( $input.length > 0 ); - assert.ok( $iframe.length > 0 ); - assert.strictEqual( $form.prop( 'target' ), $iframe.prop( 'id' ) ); - assert.strictEqual( $input.val(), 'Testing API upload.jpg' ); + assert.ok( $form.length > 0, 'form' ); + assert.ok( $input.length > 0, 'input' ); + assert.ok( $iframe.length > 0, 'frame' ); + assert.strictEqual( $form.prop( 'target' ), $iframe.prop( 'id' ), 'form.target and frame.id ' ); + assert.strictEqual( $input.val(), 'Testing API upload.jpg', 'input value' ); } ); -}( mediaWiki, jQuery ) ); +}() );