Merge "Add test to validate special page aliases"
[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.clock = this.sandbox.useFakeTimers();
5 this.server = this.sandbox.useFakeServer();
6 },
7 teardown: function () {
8 this.clock.tick( 1 );
9 }
10 } ) );
11
12 QUnit.test( 'Hello world', function ( assert ) {
13 QUnit.expect( 1 );
14
15 var api = new mw.Api();
16
17 api.parse( '\'\'\'Hello world\'\'\'' ).done( function ( html ) {
18 assert.equal( html, '<p><b>Hello world</b></p>' );
19 } );
20
21 this.server.respondWith( /action=parse.*&text='''Hello\+world'''/, function ( request ) {
22 request.respond( 200, { 'Content-Type': 'application/json' },
23 '{ "parse": { "text": { "*": "<p><b>Hello world</b></p>" } } }'
24 );
25 } );
26
27 this.server.respond();
28 } );
29 }( mediaWiki ) );