mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 21:04:11 +00:00
a5cddef17a
Also removes the index inside the location hash Change-Id: I9429ff0101ab891f2c4c6aa2d989fbef0813252d Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/136
19 lines
767 B
JavaScript
Executable file
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 ) );
|