2023-11-04 17:32:09 +01:00
|
|
|
import { fillIn, visit } from '@ember/test-helpers';
|
2018-12-29 20:35:04 +01:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupApplicationTest } from 'ember-qunit';
|
2016-08-21 14:31:39 +02:00
|
|
|
|
2023-10-15 20:37:03 +02:00
|
|
|
module('Acceptance | i18n', function (hooks) {
|
|
|
|
hooks.beforeEach(function () {
|
2018-12-29 20:35:04 +01:00
|
|
|
window.localStorage.setItem('locale', 'de');
|
|
|
|
});
|
2016-08-21 14:31:39 +02:00
|
|
|
|
2018-12-29 20:35:04 +01:00
|
|
|
setupApplicationTest(hooks);
|
2016-08-21 14:31:39 +02:00
|
|
|
|
2023-10-15 20:37:03 +02:00
|
|
|
test('locale is saved in localStorage', async function (assert) {
|
2018-12-29 20:35:04 +01:00
|
|
|
await visit('/');
|
2023-11-04 17:32:09 +01:00
|
|
|
assert
|
|
|
|
.dom('.language-select')
|
|
|
|
.hasValue('de', 'picks up locale in locale storage');
|
2016-08-21 14:31:39 +02:00
|
|
|
|
2023-09-21 12:30:14 +02:00
|
|
|
await fillIn('.language-select', 'en');
|
2023-11-04 17:32:09 +01:00
|
|
|
assert.dom('.language-select').hasValue('en', 'shows changed locale');
|
|
|
|
assert.strictEqual(
|
2023-10-15 20:37:03 +02:00
|
|
|
window.localStorage.getItem('locale'),
|
|
|
|
'en',
|
2023-10-17 10:44:45 +02:00
|
|
|
'persisted in localeStorage',
|
2018-12-29 20:35:04 +01:00
|
|
|
);
|
2016-08-21 14:31:39 +02:00
|
|
|
});
|
|
|
|
});
|