(Bug 41352) Provide tests for edit conflicts.
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki.api / mediawiki.api.parse.test.js
1 QUnit.module( 'mediawiki.api.parse', QUnit.newMwEnvironment() );
2
3 QUnit.asyncTest( 'Hello world', function ( assert ) {
4 var api;
5 QUnit.expect( 6 );
6
7 api = new mw.Api();
8
9 api.parse( "'''Hello world'''" )
10 .done( function ( html ) {
11 // Parse into a document fragment instead of comparing HTML, due to
12 // presence of Tidy influencing whitespace.
13 // Html also contains "NewPP report" comment.
14 var $res = $( '<div>' ).html( html ).children(),
15 res = $res.get( 0 );
16 assert.equal( $res.length, 1, 'Response contains 1 element' );
17 assert.equal( res.nodeName.toLowerCase(), 'p', 'Response is a paragraph' );
18 assert.equal( $res.children().length, 1, 'Response has 1 child element' );
19 assert.equal( $res.children().get( 0 ).nodeName.toLowerCase(), 'b', 'Child element is a bold tag' );
20 // Trim since Tidy may or may not mess with the spacing here
21 assert.equal( $.trim( $res.text() ), 'Hello world', 'Response contains given text' );
22 assert.equal( $res.find( 'b' ).text(), 'Hello world', 'Bold tag wraps the entire, same, text' );
23
24 QUnit.start();
25 });
26 });