2014-06-11 04:34:49 +00:00
|
|
|
( function ( $, mw ) {
|
|
|
|
|
|
|
|
QUnit.module( 'ext.popups' );
|
|
|
|
QUnit.test( 'render.article.getProcessedHtml', function ( assert ) {
|
2014-11-26 02:21:03 +00:00
|
|
|
QUnit.expect( 7 );
|
2014-06-11 04:34:49 +00:00
|
|
|
|
|
|
|
function test ( extract, title, expected ) {
|
|
|
|
assert.equal(
|
|
|
|
mw.popups.render.article.getProcessedHtml( extract, title ),
|
|
|
|
expected
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
test(
|
|
|
|
'Isaac Newton was born in', 'Isaac Newton',
|
|
|
|
'<b>Isaac Newton</b> was born in'
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
'The C* language not to be confused with C# or C', 'C*',
|
|
|
|
'The <b>C*</b> language not to be confused with C# or C'
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
'Person (was born in Location) is good', 'Person',
|
|
|
|
'<b>Person</b> is good'
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
'Person (was born in Location (at Time)) is good', 'Person',
|
|
|
|
'<b>Person</b> is good'
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
'Person (was born in Location (at Time) ) is good', 'Person',
|
|
|
|
'<b>Person</b> is good'
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
'Brackets ) are funny ( when not used properly', 'Brackets',
|
|
|
|
'<b>Brackets</b> ) are funny ( when not used properly'
|
|
|
|
);
|
|
|
|
|
2014-11-26 02:21:03 +00:00
|
|
|
test(
|
|
|
|
'Epic XSS <script>alert("XSS")</script> is epic', 'Epic XSS',
|
|
|
|
'<b>Epic XSS</b> <script>alert</script> is epic'
|
|
|
|
);
|
|
|
|
|
2014-06-11 04:34:49 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
} ) ( jQuery, mediaWiki );
|