blob: cd0db7c965ec795819381ae7b8395c2c179697ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
( function ( mw ) {
QUnit.module( 'mediawiki.api.parse', QUnit.newMwEnvironment( {
setup: function () {
this.server = this.sandbox.useFakeServer();
}
} ) );
QUnit.test( 'Hello world', function ( assert ) {
QUnit.expect( 1 );
var api = new mw.Api();
api.parse( '\'\'\'Hello world\'\'\'' ).done( function ( html ) {
assert.equal( html, '<p><b>Hello world</b></p>' );
} );
this.server.respondWith( /action=parse.*&text='''Hello\+world'''/, function ( request ) {
request.respond( 200, { 'Content-Type': 'application/json' },
'{ "parse": { "text": { "*": "<p><b>Hello world</b></p>" } } }'
);
} );
this.server.respond();
} );
}( mediaWiki ) );
|