mediawiki-extensions-Multim.../tests/qunit/mmv.ui.test.js
Gilles Dubuc a5cddef17a Lazy-load mmv
Also removes the index inside the location hash

Change-Id: I9429ff0101ab891f2c4c6aa2d989fbef0813252d
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/136
2014-02-18 15:55:15 -08:00

19 lines
767 B
JavaScript
Executable file

( function ( mw, $ ) {
QUnit.module( 'mmv.ui', QUnit.newMwEnvironment() );
QUnit.test( 'HTML whitelisting works', 2, function ( assert ) {
var okhtml = '<a href="/wiki/Blah">Blah</a> blah blah',
needswhitelisting = '<div>Blah<br />blah</div>',
whitelisted = 'Blahblah',
okjq = $.parseHTML( okhtml ),
nwljq = $.parseHTML( needswhitelisting ),
$sandbox = $( '<div>' );
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 ) );