mediawiki.api.parse: Allow parsing pages
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.parse.test.js
index cd0db7c..4fab90d 100644 (file)
@@ -6,7 +6,7 @@
        } ) );
 
        QUnit.test( 'Hello world', function ( assert ) {
-               QUnit.expect( 1 );
+               QUnit.expect( 2 );
 
                var api = new mw.Api();
 
 
                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>" } } }'
+                               '{ "parse": { "text": "<p><b>Hello world</b></p>" } }'
+                       );
+               } );
+
+               api.parse( new mw.Title( 'Earth' ) ).done( function ( html ) {
+                       assert.equal( html, '<p><b>Earth</b> is a planet.</p>' );
+               } );
+
+               this.server.respondWith( /action=parse.*&page=Earth/, function ( request ) {
+                       request.respond( 200, { 'Content-Type': 'application/json' },
+                               '{ "parse": { "text": "<p><b>Earth</b> is a planet.</p>" } }'
                        );
                } );