( function ( mw, $ ) { QUnit.module( 'mmv.ui', QUnit.newMwEnvironment() ); QUnit.test( 'HTML whitelisting works', 2, function ( assert ) { var okhtml = 'Blah blah blah', needswhitelisting = '
Blah
blah
', whitelisted = 'Blahblah', okjq = $.parseHTML( okhtml ), nwljq = $.parseHTML( needswhitelisting ), $sandbox = $( '
' ); mw.mmv.ui.Element.prototype.whitelistHtml( $sandbox.empty().append( okjq ) ); assert.strictEqual( $sandbox.html(), okhtml, 'Whitelisted elements are let through.' ); mw.mmv.ui.Element.prototype.whitelistHtml( $sandbox.empty().append( nwljq ) ); assert.strictEqual( $sandbox.html(), whitelisted, 'Not-whitelisted elements are removed.' ); } ); }( mediaWiki, jQuery ) );