mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-26 09:05:26 +00:00
53da285b07
* merges parent classes into child classes * moves some files and tests to have a consistent directory structure Change-Id: I360cc0805d8a561f5105fb063747457f67e1fccd Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/177
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 ) );
|