Merge "Add debug logging for the case that the API goes read only"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.parse.test.js
1 ( function ( mw ) {
2 QUnit.module( 'mediawiki.api.parse', QUnit.newMwEnvironment( {
3 setup: function () {
4 this.server = this.sandbox.useFakeServer();
5 }
6 } ) );
7
8 QUnit.test( 'Hello world', function ( assert ) {
9 QUnit.expect( 1 );
10
11 var api = new mw.Api();
12
13 api.parse( '\'\'\'Hello world\'\'\'' ).done( function ( html ) {
14 assert.equal( html, '<p><b>Hello world</b></p>' );
15 } );
16
17 this.server.respondWith( /action=parse.*&text='''Hello\+world'''/, function ( request ) {
18 request.respond( 200, { 'Content-Type': 'application/json' },
19 '{ "parse": { "text": "<p><b>Hello world</b></p>" } }'
20 );
21 } );
22
23 this.server.respond();
24 } );
25 }( mediaWiki ) );