From fd4492f2299878d231f5bfeb5414153b62fb25ba Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 18 Jan 2020 07:09:56 +0100 Subject: [PATCH] ensuring that both critical branches get tested --- js/test/I18n.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/js/test/I18n.js b/js/test/I18n.js index 9bfc76a..ba10e63 100644 --- a/js/test/I18n.js +++ b/js/test/I18n.js @@ -39,13 +39,13 @@ describe('I18n', function () { } ); 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', '(small nearray) string', 'string', function (prefix, params, postfix) { prefix = prefix.replace(/%(s|d)/g, '%%'); - params[0] = params[0].replace(/%(s|d)/g, '%%'); + params[0] = params[0].replace(/%(s|d)/g, '%%').replace(/%'; + 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 () {