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=7340ddc12e299943485f8c928124a0890533dd9c;hp=cd0db7c965ec795819381ae7b8395c2c179697ee;hpb=51a6d0676b8fe6a286b6b498ad95561ccdf4e3da;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 cd0db7c965..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,17 +6,35 @@ } ) ); 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 ) { request.respond( 200, { 'Content-Type': 'application/json' }, - '{ "parse": { "text": { "*": "

Hello world

" } } }' + '{ "parse": { "text": "

Hello world

" } }' + ); + } ); + + 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.

" } }' ); } );