'Foo are <a href="http://example.org" class="external">some</a> things.',
'Plural fallback to the "other" plural form'
);
assert.strictEqual(
formatParse('plural-only-explicit-forms',2),
'It is a double room.',
'Plural with explicit forms alone.'
);
});
QUnit.test('Plural',(assert)=>{
assert.strictEqual(formatParse('plural-msg',0),'Found 0 items','Plural test for english with zero as count');
assert.strictEqual(formatParse('plural-msg',1),'Found 1 item','Singular test for english');
assert.strictEqual(formatParse('plural-msg',2),'Found 2 items','Plural test for english');
assert.strictEqual(formatParse('plural-msg-explicit-forms-nested',6),'Found 6 results','Plural message with explicit plural forms');
assert.strictEqual(formatParse('plural-msg-explicit-forms-nested',0),'Found no results in Wiki','Plural message with explicit plural forms, with nested {{SITENAME}}');
assert.strictEqual(formatParse('plural-msg-explicit-forms-nested',1),'Found 1 result','Plural message with explicit plural forms with placeholder nested');
assert.strictEqual(formatParse('plural-empty-explicit-form',0),'There is me.');
assert.strictEqual(formatParse('plural-empty-explicit-form',1),'There is me and other people.');
assert.strictEqual(formatParse('plural-empty-explicit-form',2),'There is me and other people.');
assert.strictEqual(formatParse('formal-msg-one-argument'),'Single form','Formal Test with a single argument when the second argument should be chosen');
// The below three are all identical to or based on real messages. For disambiguations-text,
// the bold was removed because it is not yet implemented.
assert.htmlEqual(
formatParse('jquerymsg-test-statistics-users'),
expectedListUsers,
'Piped wikilink'
);
constexpectedDisambiguationsText='The following pages contain at least one link to a disambiguation page.\nThey may have to link to a more appropriate page instead.\nA page is treated as a disambiguation page if it uses a template that is linked from '+
mw.messages.set('disambiguations-text','The following pages contain at least one link to a disambiguation page.\nThey may have to link to a more appropriate page instead.\nA page is treated as a disambiguation page if it uses a template that is linked from [[MediaWiki:Disambiguationspage]].');
constexpectedSpecialCharacters='<a title=""Who" wants to be a millionaire & live on 'Exotic Island'?" href="/wiki/%22Who%22_wants_to_be_a_millionaire_%26_live_on_%27Exotic_Island%27%3F">"Who" wants to be a millionaire & live on 'Exotic Island'?</a>';
'External link message allows protocol-relative URL when processed'
);
assert.htmlEqual(
formatParse('external-link-replace',$('<i>')),
'Foo <i>bar</i>',
'External link message processed as jQuery object when format is \'parse\''
);
assert.htmlEqual(
formatParse('external-link-replace',()=>{}),
'Foo <a role="button" tabindex="0">bar</a>',
'External link message processed as function when format is \'parse\''
);
mw.config.set('wgUserLanguage',oldUserLang);
});
QUnit.test('Int',(assert)=>{
constnewarticletextSource='You have followed a link to a page that does not exist yet. To create the page, start typing in the box below (see the [[{{Int:Foobar}}|foobar]] for more info). If you are here by mistake, click your browser\'s back button.',
helpPageTitle='Help:Foobar';
constexpectedNewarticletext='You have followed a link to a page that does not exist yet. To create the page, start typing in the box below (see the '+
'<a title="Help:Foobar" href="/wiki/Help:Foobar">foobar</a> for more info). If you are here by mistake, click your browser\'s back button.';
mw.config.set('wgUserLanguage','en');
mw.messages.set({
foobar:helpPageTitle,
newarticletext:newarticletextSource
});
assert.htmlEqual(
formatParse('newarticletext'),
expectedNewarticletext,
'Link with nested message'
);
assert.strictEqual(
formatParse('see-portal-url'),
'Project:Community portal is an important community page.',