Comments (2)
It turns out to be possible to do this, but it's a little tricky. You can inject the i18n service into the integration test and configure it in the beforeEach()
function. Because beforeEach
and afterEach
apparently don't respect promises (see rwjblue/ember-qunit#192) you have to use assert.async
to wait for initialization to finish:
moduleForComponent('some-component', 'Integration | Component | some component', {
integration: true,
beforeEach(assert) {
const done = assert.async();
this.inject.service('i18n');
this.get('i18n').initLibraryAsync().then(done);
}
});
You will probably also want to adjust the i18nextOptions
for the test environment to set and preload the initial language as well.
I'll document how this works before releasing the latest version later this week. I haven't looked at trying to create a test helper that initializes i18next yet, but it may be possible.
from ember-i18next.
For future reference, the full list of links I used to figure this out:
https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Testing#integration-tests
emberjs/ember-test-helpers#114
https://github.com/rwjblue/ember-qunit/issues/192
from ember-i18next.
Related Issues (20)
- Collaborate with ember-i18n / ember-cli-i18n / ember-intl? HOT 2
- Error with Ember.js 1.13
- Changing the language does not work anymore with Ember.js 1.13 HOT 4
- Provide Ember 2.2.0 Initializer example HOT 2
- Ember Server failing after including ember-18next HOT 3
- Update to i18next 2.X
- Fix Ember.warn Deprecations
- ES2015 Conversion
- Rejected Promise in Init With Missing Locale Files HOT 7
- unable to use github version of ember-i18next, broccoli build error HOT 4
- Upgrade Documentation
- Test Helper to Initialize Service
- Mechanism to Configure Other Plugins HOT 1
- incompatible with ember 2.9.0 latest HOT 1
- Macro inspired by ember-i18n HOT 1
- Variable replacement support for computed properties HOT 1
- Future of this add-on HOT 4
- htmlSafe is now in @ember/template
- Document Expectations for Contributions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-i18next.