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

29 lines
755 B
JavaScript
Raw Normal View History

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';
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('/');
assert.equal(
find('.language-select').value,
'de',
'picks up locale in locale storage',
);
await fillIn('.language-select', 'en');
2018-12-29 20:35:04 +01:00
assert.equal(find('.language-select').value, 'en');
assert.equal(
window.localStorage.getItem('locale'),
'en',
'persisted in localeStorage',
2018-12-29 20:35:04 +01:00
);
});
});