2023-09-21 12:30:14 +02:00
|
|
|
import { fillIn, find, 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-10-15 20:37:03 +02:00
|
|
|
assert.equal(
|
|
|
|
find('.language-select').value,
|
|
|
|
'de',
|
2023-10-17 10:44:45 +02:00
|
|
|
'picks up locale in locale storage',
|
2023-10-15 20:37:03 +02:00
|
|
|
);
|
2016-08-21 14:31:39 +02:00
|
|
|
|
2023-09-21 12:30:14 +02:00
|
|
|
await fillIn('.language-select', 'en');
|
2018-12-29 20:35:04 +01:00
|
|
|
assert.equal(find('.language-select').value, 'en');
|
|
|
|
assert.equal(
|
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
|
|
|
});
|
|
|
|
});
|