fix side effect in unit tests for languages by only parsing a copy of imported languages object to ember-i18n
This commit is contained in:
parent
82c22824a6
commit
8b74eb7d86
2 changed files with 9 additions and 14 deletions
|
@ -30,7 +30,7 @@ export default {
|
||||||
|
|
||||||
Ember.FEATURES.I18N_TRANSLATE_HELPER_SPAN = false;
|
Ember.FEATURES.I18N_TRANSLATE_HELPER_SPAN = false;
|
||||||
Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS = true;
|
Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS = true;
|
||||||
Ember.I18n.translations = translations[language];
|
Ember.I18n.translations = Ember.copy(translations[language]);
|
||||||
Ember.I18n.locale = language;
|
Ember.I18n.locale = language;
|
||||||
|
|
||||||
// inject into controller
|
// inject into controller
|
||||||
|
|
|
@ -6,11 +6,7 @@ module('Unit | languages');
|
||||||
// Replace this with your real tests.
|
// Replace this with your real tests.
|
||||||
test('translations are correct', function(assert) {
|
test('translations are correct', function(assert) {
|
||||||
assert.ok(languages);
|
assert.ok(languages);
|
||||||
/*
|
|
||||||
* test not working
|
|
||||||
* ember-i18n pluralization seems to add another key to languages object
|
|
||||||
* not sure why this modified languages object is retrieved by test
|
|
||||||
* https://github.com/jamesarosen/ember-i18n/tree/810aa7f04b2d30903fa094a5aac10bd4c936fcfe#pluralization
|
|
||||||
Object.keys(languages).map(function(language) {
|
Object.keys(languages).map(function(language) {
|
||||||
if (language !== 'en') {
|
if (language !== 'en') {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@ -20,7 +16,6 @@ test('translations are correct', function(assert) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
Object.keys(languages.en).map(function(translationKey) {
|
Object.keys(languages.en).map(function(translationKey) {
|
||||||
Object.keys(languages).map(function(language) {
|
Object.keys(languages).map(function(language) {
|
||||||
|
|
Loading…
Reference in a new issue