X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki.api%2Fmediawiki.api.parse.test.js;h=dc0cff40e682da9cc6662506d0b32a5f075065e5;hb=2f885ee6b797e5a176ce7b270b674a04b5945b06;hp=f2865ebb63337ee838a1c3b55ddd0d15ce23d97f;hpb=ae69acacf567077b3f49d1fe6c3f3770e72a9093;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js index f2865ebb63..dc0cff40e6 100644 --- a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js +++ b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js @@ -6,12 +6,20 @@ } ) ); QUnit.test( 'Hello world', function ( assert ) { - QUnit.expect( 1 ); + QUnit.expect( 3 ); var api = new mw.Api(); api.parse( '\'\'\'Hello world\'\'\'' ).done( function ( html ) { - assert.equal( html, '

Hello world

' ); + assert.equal( html, '

Hello world

', 'Parse wikitext by string' ); + } ); + + api.parse( { + toString: function () { + return '\'\'\'Hello world\'\'\''; + } + } ).done( function ( html ) { + assert.equal( html, '

Hello world

', 'Parse wikitext by toString object' ); } ); this.server.respondWith( /action=parse.*&text='''Hello\+world'''/, function ( request ) { @@ -20,6 +28,16 @@ ); } ); + api.parse( new mw.Title( 'Earth' ) ).done( function ( html ) { + assert.equal( html, '

Earth is a planet.

', 'Parse page by Title object' ); + } ); + + this.server.respondWith( /action=parse.*&page=Earth/, function ( request ) { + request.respond( 200, { 'Content-Type': 'application/json' }, + '{ "parse": { "text": "

Earth is a planet.

" } }' + ); + } ); + this.server.respond(); } ); }( mediaWiki ) );