mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
renderer.article: Bold the title no matter what the trailing characters
Bug: T69229 Change-Id: I833c0dcae98010bc74b6b58ae8035aaac4e6465b
This commit is contained in:
parent
a43ef7ca51
commit
df0b988eec
|
@ -155,7 +155,7 @@
|
|||
title = title.replace( /([.?*+^$[\]\\(){}|-])/g, '\\$1' ); // Escape RegExp elements
|
||||
|
||||
var elements = [],
|
||||
regExp = new RegExp( '(^|\\s)(' + title + ')(\\s|$)', 'ig' ),
|
||||
regExp = new RegExp( '(^|\\s)(' + title + ')(|$)', 'ig' ),
|
||||
boldIdentifier = '<bi-' + Math.random() + '>',
|
||||
snip = '<snip-' + Math.random() + '>';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
QUnit.module( 'ext.popups' );
|
||||
QUnit.test( 'render.article.getProcessedElements', function ( assert ) {
|
||||
QUnit.expect( 9 );
|
||||
QUnit.expect( 11 );
|
||||
|
||||
function test ( extract, title, expected, msg ) {
|
||||
var $div = $( '<div>' ).append(
|
||||
|
@ -29,6 +29,12 @@
|
|||
'Extract with text in parentheses'
|
||||
);
|
||||
|
||||
test(
|
||||
'Person, (was born in Location) is good', 'Person',
|
||||
'<b>Person</b>, is good',
|
||||
'Comma after title'
|
||||
);
|
||||
|
||||
test(
|
||||
'Person (was born in Location (at Time)) is good', 'Person',
|
||||
'<b>Person</b> is good',
|
||||
|
@ -41,6 +47,12 @@
|
|||
'Extract with nested parentheses and random spaces'
|
||||
);
|
||||
|
||||
test(
|
||||
'I like trains', 'Train',
|
||||
'I like <b>train</b>s',
|
||||
'Make the simple plural bold'
|
||||
);
|
||||
|
||||
test(
|
||||
'Brackets ) are funny ( when not used properly', 'Brackets',
|
||||
'<b>Brackets</b> ) are funny ( when not used properly',
|
||||
|
|
Loading…
Reference in a new issue