Co-authored-by: Mikhail Bashkirov <mikhail.bashkirov@ing.com> Co-authored-by: Thijs Louisse <thijs.louisse@ing.com> Co-authored-by: Joren Broekema <joren.broekema@ing.com> Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com> Co-authored-by: Erik Kroes <erik.kroes@ing.com> Co-authored-by: Lars den Bakker <lars.den.bakker@ing.com>
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
/* eslint-env mocha */
|
|
/* eslint-disable no-underscore-dangle */
|
|
import { expect } from '@open-wc/testing';
|
|
|
|
import { LionSingleton } from '@lion/core';
|
|
import { LocalizeManager } from '../src/LocalizeManager.js';
|
|
|
|
import { localize, setLocalize } from '../src/localize.js';
|
|
|
|
describe('localize', () => {
|
|
// this is an importan mindset:
|
|
// we don't test the singleton
|
|
// we check that it is an instance of the right class
|
|
// we test newly created instances of this class separately
|
|
// this allows to avoid any side effects caused by changing singleton state between tests
|
|
|
|
it('is a singleton', () => {
|
|
expect(localize).to.be.an.instanceOf(LionSingleton);
|
|
});
|
|
|
|
it('is an instance of LocalizeManager', () => {
|
|
expect(localize).to.be.an.instanceOf(LocalizeManager);
|
|
});
|
|
|
|
it('is overridable globally', () => {
|
|
const oldLocalize = localize;
|
|
const newLocalize = {};
|
|
setLocalize(newLocalize);
|
|
expect(localize).to.equal(newLocalize);
|
|
setLocalize(oldLocalize);
|
|
});
|
|
|
|
it('is configured to automatically load namespaces if locale is changed', () => {
|
|
expect(localize._autoLoadOnLocaleChange).to.equal(true);
|
|
});
|
|
});
|