1 QUnit
.module( 'mediawiki.api.parse', QUnit
.newMwEnvironment() );
3 QUnit
.asyncTest( 'Hello world', function ( assert
) {
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(),
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' );