mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 09:42:56 +00:00
31 lines
795 B
JavaScript
31 lines
795 B
JavaScript
describe("locale", function() {
|
|
var saved, error;
|
|
|
|
beforeEach(function() {
|
|
saved = locale;
|
|
error = console.error;
|
|
console.error = function () {};
|
|
locale = { _current: 'en', en: {test: 'test', foo: 'bar'}, __: {}}
|
|
});
|
|
|
|
afterEach(function() {
|
|
locale = saved;
|
|
console.error = error;
|
|
});
|
|
|
|
describe("t", function() {
|
|
it("defaults to locale._current", function() {
|
|
expect(t('test')).to.equal('test');
|
|
});
|
|
|
|
it("supports a default option", function() {
|
|
expect(t('nonesuch', {default: 'default'})).to.equal('default');
|
|
});
|
|
|
|
it("falls back to en", function() {
|
|
locale._current = '__';
|
|
expect(t('test')).to.equal('test');
|
|
});
|
|
});
|
|
});
|