@ -156,14 +156,14 @@ describe('new Translator(language)', function () {
it('should use backup for unknown keys with arguments',function(){
vartranslator=Translator.create('en-GB');
returntranslator.translate('[[unknown:key.with.args, arguments are here, derpity, derp]]').then(function(translated){
assert.strictEqual(translated,'[[unknown:key.with.args, arguments are here, derpity, derp[[');
assert.strictEqual(translated,'unknown:key.with.args, arguments are here, derpity, derp');
});
});
it('should ignore unclosed tokens',function(){
vartranslator=Translator.create('en-GB');
returntranslator.translate('here is some stuff and other things [[abc:xyz, other random stuff should be fine here [[global:home]] and more things [[pages:users/latest]]').then(function(translated){
assert.strictEqual(translated,'here is some stuff and other things [[abc:xyz, other random stuff should be fine here Home and more things Latest Users');
assert.strictEqual(translated,'here is some stuff and other things abc:xyz, other random stuff should be fine here Home and more things Latest Users');
});
});
});
@ -248,7 +248,7 @@ describe('Translator static methods', function () {
it('should escape translation patterns within text',function(done){
assert.strictEqual(
Translator.escape('some nice text [[global:home]] here'),
'some nice text \\[\\[global:home\\]\\] here'
'some nice text [[global:home]] here'
);
done();
});
@ -260,6 +260,10 @@ describe('Translator static methods', function () {
Translator.unescape('some nice text \\[\\[global:home\\]\\] here'),
'some nice text [[global:home]] here'
);
assert.strictEqual(
Translator.unescape('some nice text [[global:home]] here'),