Add test for missing browser language
This commit is contained in:
parent
c6950b9b56
commit
944c8c2912
1 changed files with 22 additions and 0 deletions
|
@ -99,6 +99,28 @@ describe('I18n', function () {
|
|||
return language === result && language === alias;
|
||||
}
|
||||
);
|
||||
|
||||
jsc.property(
|
||||
'should default to en',
|
||||
function() {
|
||||
var clean = jsdom('', {url: 'https://privatebin.net/'});
|
||||
|
||||
[ 'language', 'userLanguage' ].forEach(function (key) {
|
||||
Object.defineProperty(navigator, key, {
|
||||
value: undefined,
|
||||
writeable: false
|
||||
});
|
||||
});
|
||||
|
||||
$.PrivateBin.I18n.reset('en');
|
||||
$.PrivateBin.I18n.loadTranslations();
|
||||
var result = $.PrivateBin.I18n.translate('en'),
|
||||
alias = $.PrivateBin.I18n._('en');
|
||||
|
||||
clean();
|
||||
return 'en' === result && 'en' === alias;
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue