|
@@ -270,7 +270,8 @@ describe('Helper', function () {
|
|
|
cookieArray = [],
|
|
cookieArray = [],
|
|
|
count = 0;
|
|
count = 0;
|
|
|
labels.forEach(function(item, i) {
|
|
labels.forEach(function(item, i) {
|
|
|
- var key = item.replace(/[\s;,=]/g, 'x'),
|
|
|
|
|
|
|
+ // deliberatly using a non-ascii key for replacing invalid characters
|
|
|
|
|
+ var key = item.replace(/[\s;,=]/g, '£'),
|
|
|
value = (values[i] || values[0]).replace(/[\s;,=]/g, '');
|
|
value = (values[i] || values[0]).replace(/[\s;,=]/g, '');
|
|
|
cookieArray.push(key + '=' + value);
|
|
cookieArray.push(key + '=' + value);
|
|
|
if (Math.random() < 1 / i)
|
|
if (Math.random() < 1 / i)
|
|
@@ -325,6 +326,27 @@ describe('Helper', function () {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+describe('I18n', function () {
|
|
|
|
|
+ describe('translate', function () {
|
|
|
|
|
+ before(function () {
|
|
|
|
|
+ $.PrivateBin.I18n.reset();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ jsc.property(
|
|
|
|
|
+ 'returns message ID unchanged if no translation found',
|
|
|
|
|
+ 'string',
|
|
|
|
|
+ function (messageId) {
|
|
|
|
|
+ var result = $.PrivateBin.I18n.translate(messageId);
|
|
|
|
|
+ $.PrivateBin.I18n.reset();
|
|
|
|
|
+ var alias = $.PrivateBin.I18n._(messageId);
|
|
|
|
|
+ $.PrivateBin.I18n.reset();
|
|
|
|
|
+ return messageId === result &&
|
|
|
|
|
+ messageId === alias;
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
describe('Model', function () {
|
|
describe('Model', function () {
|
|
|
describe('getPasteId', function () {
|
|
describe('getPasteId', function () {
|
|
|
before(function () {
|
|
before(function () {
|