mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
renderer.article: Remove leading spaces before brackets
Bug: T69225 Change-Id: I83f79fa0ebd19bea6ed7ea266cece0778210adb2
This commit is contained in:
parent
df0b988eec
commit
3eaf2829e8
|
@ -210,6 +210,10 @@
|
|||
continue;
|
||||
}
|
||||
if ( level === 0 ) {
|
||||
// Remove leading spaces before brackets
|
||||
if ( ch === ' ' && string.charAt( i + 1 ) === '(' ) {
|
||||
continue;
|
||||
}
|
||||
newString += ch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
QUnit.module( 'ext.popups' );
|
||||
QUnit.test( 'render.article.getProcessedElements', function ( assert ) {
|
||||
QUnit.expect( 11 );
|
||||
QUnit.expect( 12 );
|
||||
|
||||
function test ( extract, title, expected, msg ) {
|
||||
var $div = $( '<div>' ).append(
|
||||
|
@ -59,6 +59,12 @@
|
|||
'Extract with unbalanced parentheses'
|
||||
);
|
||||
|
||||
test(
|
||||
'Vappu (born August 7), also known as Lexy', 'Vappu',
|
||||
'<b>Vappu</b>, also known as Lexy',
|
||||
'Spaces around bracketed text should be removed'
|
||||
);
|
||||
|
||||
test(
|
||||
'Epic XSS <script>alert("XSS")</script> is epic', 'Epic XSS',
|
||||
'<b>Epic XSS</b> <script>alert</script> is epic',
|
||||
|
|
Loading…
Reference in a new issue