decide.nolog.cz/tests/acceptance/i18n-test.js

27 lines
758 B
JavaScript
Raw Normal View History

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';
module('Acceptance | i18n', function (hooks) {
hooks.beforeEach(function () {
2018-12-29 20:35:04 +01:00
window.localStorage.setItem('locale', 'de');
});
2018-12-29 20:35:04 +01:00
setupApplicationTest(hooks);
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');
await fillIn('.language-select', 'en');
2023-11-04 17:32:09 +01:00
assert.dom('.language-select').hasValue('en', 'shows changed locale');
assert.strictEqual(
window.localStorage.getItem('locale'),
'en',
'persisted in localeStorage',
2018-12-29 20:35:04 +01:00
);
});
});