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.options.test.js;h=549deb0e1b3ca45e8b108f68e6ab333754788ca8;hp=854e4b15e51b107050c0022d8b930f4a5f5f6e5d;hb=fe94275c8fcfc248a5eae857dde7c5772d993ab5;hpb=22806b0a4509e97b56fb52b387e17e3c80fb7eb2 diff --git a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js index 854e4b15e5..549deb0e1b 100644 --- a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js +++ b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js @@ -1,4 +1,4 @@ -( function ( mw ) { +( function () { QUnit.module( 'mediawiki.api.options', QUnit.newMwEnvironment( { setup: function () { this.server = this.sandbox.useFakeServer(); @@ -30,7 +30,7 @@ // Requests are POST, match requestBody instead of url this.server.respond( function ( request ) { - if ( $.inArray( request.requestBody, [ + if ( [ // simple 'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C', // two options @@ -43,7 +43,7 @@ 'action=options&format=json&formatversion=2&change=foo&token=%2B%5C', // reset an option, not bundleable 'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C' - ] ) !== -1 ) { + ].indexOf( request.requestBody ) !== -1 ) { assert.ok( true, 'Repond to ' + request.requestBody ); request.respond( 200, { 'Content-Type': 'application/json' }, '{ "options": "success" }' ); @@ -88,7 +88,7 @@ // Requests are POST, match requestBody instead of url this.server.respond( function ( request ) { - if ( $.inArray( request.requestBody, [ + if ( [ // simple 'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C', // two options @@ -102,10 +102,13 @@ 'action=options&format=json&formatversion=2&change=foo&token=%2B%5C', // reset an option, not bundleable 'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C' - ] ) !== -1 ) { + ].indexOf( request.requestBody ) !== -1 ) { assert.ok( true, 'Repond to ' + request.requestBody ); - request.respond( 200, { 'Content-Type': 'application/json' }, - '{ "options": "success" }' ); + request.respond( + 200, + { 'Content-Type': 'application/json' }, + '{ "options": "success" }' + ); } else { assert.ok( false, 'Unexpected request: ' + request.requestBody ); } @@ -135,4 +138,4 @@ } ) ); } ); -}( mediaWiki ) ); +}() );