diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js')
-rw-r--r-- | tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js new file mode 100644 index 00000000..3d3f630f --- /dev/null +++ b/tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js @@ -0,0 +1,26 @@ +QUnit.module( 'mediawiki.api.parse', QUnit.newMwEnvironment() ); + +QUnit.asyncTest( 'Hello world', function ( assert ) { + var api; + QUnit.expect( 6 ); + + api = new mw.Api(); + + api.parse( "'''Hello world'''" ) + .done( function ( html ) { + // Parse into a document fragment instead of comparing HTML, due to + // presence of Tidy influencing whitespace. + // Html also contains "NewPP report" comment. + var $res = $( '<div>' ).html( html ).children(), + res = $res.get( 0 ); + assert.equal( $res.length, 1, 'Response contains 1 element' ); + assert.equal( res.nodeName.toLowerCase(), 'p', 'Response is a paragraph' ); + assert.equal( $res.children().length, 1, 'Response has 1 child element' ); + assert.equal( $res.children().get( 0 ).nodeName.toLowerCase(), 'b', 'Child element is a bold tag' ); + // Trim since Tidy may or may not mess with the spacing here + assert.equal( $.trim( $res.text() ), 'Hello world', 'Response contains given text' ); + assert.equal( $res.find( 'b' ).text(), 'Hello world', 'Bold tag wraps the entire, same, text' ); + + QUnit.start(); + }); +}); |