Skip to content

Instantly share code, notes, and snippets.

@rik
Created May 13, 2013 16:18
Show Gist options
  • Save rik/5569538 to your computer and use it in GitHub Desktop.
Save rik/5569538 to your computer and use it in GitHub Desktop.
require('/shared/js/l10n.js');
//mocha.setup({globals: ['jsCount', 'totalResult']});
suite('l10n', function(done) {
var _;
suiteSetup(function() {
_ = navigator.mozL10n.get;
var script = document.createElement('script');
script.type = 'application/l10n';
var foo = {
'locales':
{
'en-US':
{
'foo': {'textContent': 'foo-translated'}
}
}
};
script.innerHTML = JSON.stringify(foo);
document.body.appendChild(script);
});
suite('get', function() {
test('inexisting key', function() {
assert.strictEqual(_('bla'), '');
});
test('existing key', function() {
assert.strictEqual(_('foo'), 'foo-translated');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment