mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-24 00:06:49 +00:00
Merge "Allow a free-text string 'title' field when adding characters"
This commit is contained in:
commit
c3d4bfcd2e
|
@ -581,11 +581,18 @@
|
|||
}
|
||||
if ( character && 'action' in character && 'label' in character ) {
|
||||
actions[ character.label ] = character.action;
|
||||
if ( character.titleMsg !== undefined ) {
|
||||
if ( character.titleMsg !== undefined || character.title !== undefined ) {
|
||||
var title;
|
||||
if ( character.titleMsg !== undefined ) {
|
||||
// eslint-disable-next-line mediawiki/msg-doc
|
||||
title = mw.msg( character.titleMsg );
|
||||
} else {
|
||||
title = character.title;
|
||||
}
|
||||
|
||||
return mw.html.element(
|
||||
'span',
|
||||
// eslint-disable-next-line mediawiki/msg-doc
|
||||
{ rel: character.label, title: mw.msg( character.titleMsg ) },
|
||||
{ rel: character.label, title: title },
|
||||
character.label
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -237,11 +237,24 @@
|
|||
data = {
|
||||
section: 'info',
|
||||
page: 'emoticons',
|
||||
characters: [ ':)', ':))', ':(', '<3', ';)' ]
|
||||
characters: [
|
||||
':)', ':))', ':(', '<3', ';)',
|
||||
{
|
||||
label: ':-s',
|
||||
title: 'unsure-face',
|
||||
action: {
|
||||
type: 'replace',
|
||||
options: {
|
||||
peri: ':-s',
|
||||
selectPeri: false
|
||||
}
|
||||
}
|
||||
} ]
|
||||
};
|
||||
assert.strictEqual( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 0, 'Before adding characters' );
|
||||
this.$target.wikiEditor( 'addToToolbar', data );
|
||||
assert.strictEqual( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[rel=":))"]' ).length, 1, 'After adding characters' );
|
||||
assert.strictEqual( this.$ui.find( '*[rel="info"].section *[rel="emoticons"].page *[title="unsure-face"]' ).length, 1, 'After adding characters find the set title' );
|
||||
|
||||
// Remove character
|
||||
data = {
|
||||
|
|
Loading…
Reference in a new issue