ensuring that both critical branches get tested
This commit is contained in:
parent
eb549d70d1
commit
fd4492f229
@ -39,13 +39,13 @@ describe('I18n', function () {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
jsc.property(
|
jsc.property(
|
||||||
'replaces %s in strings with first given parameter',
|
'replaces %s in strings with first given parameter, encoding all, when no link is in the messageID',
|
||||||
'string',
|
'string',
|
||||||
'(small nearray) string',
|
'(small nearray) string',
|
||||||
'string',
|
'string',
|
||||||
function (prefix, params, postfix) {
|
function (prefix, params, postfix) {
|
||||||
prefix = prefix.replace(/%(s|d)/g, '%%');
|
prefix = prefix.replace(/%(s|d)/g, '%%');
|
||||||
params[0] = params[0].replace(/%(s|d)/g, '%%');
|
params[0] = params[0].replace(/%(s|d)/g, '%%').replace(/%<a/g, '');
|
||||||
postfix = postfix.replace(/%(s|d)/g, '%%');
|
postfix = postfix.replace(/%(s|d)/g, '%%');
|
||||||
var translation = $.PrivateBin.Helper.htmlEntities(prefix + params[0] + postfix);
|
var translation = $.PrivateBin.Helper.htmlEntities(prefix + params[0] + postfix);
|
||||||
params.unshift(prefix + '%s' + postfix);
|
params.unshift(prefix + '%s' + postfix);
|
||||||
@ -56,6 +56,24 @@ describe('I18n', function () {
|
|||||||
return translation === result && translation === alias;
|
return translation === result && translation === alias;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
jsc.property(
|
||||||
|
'replaces %s in strings with first given parameter, encoding params only, when a link is part of the messageID',
|
||||||
|
'string',
|
||||||
|
'(small nearray) string',
|
||||||
|
'string',
|
||||||
|
function (prefix, params, postfix) {
|
||||||
|
prefix = prefix.replace(/%(s|d)/g, '%%');
|
||||||
|
params[0] = params[0].replace(/%(s|d)/g, '%%') + '<a/>';
|
||||||
|
postfix = postfix.replace(/%(s|d)/g, '%%');
|
||||||
|
var translation = $.PrivateBin.Helper.htmlEntities(prefix + params[0] + postfix);
|
||||||
|
params.unshift(prefix + '%s' + postfix);
|
||||||
|
var result = $.PrivateBin.I18n.translate.apply(this, params);
|
||||||
|
$.PrivateBin.I18n.reset();
|
||||||
|
var alias = $.PrivateBin.I18n._.apply(this, params);
|
||||||
|
$.PrivateBin.I18n.reset();
|
||||||
|
return translation === result && translation === alias;
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getPluralForm', function () {
|
describe('getPluralForm', function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user