-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests as specified in #14 #23
Conversation
@@ -125,7 +125,7 @@ export default Ember.Object.extend({ | |||
export default DS.Model.extend({ | |||
name: function() { | |||
return this.t('name', 'John', 'Doe'); | |||
} | |||
}.property() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have this as a separate commit as it does not fit within the context of this PR.
In addition, we prefer the long-form for CPs:
name: Ember.computed(function() {
return this.t('name', 'John', 'Doe');
})
alright will change the PR according to your comments |
I tried to rewrite the tests. Basically I wanted to implement the initializer unit test. The problem: I am not able to join the ember-wires correctly. My idea was to write something like that. But unfortunately t does not get injected. So, can you give me a hint on how to do this? I can not find any working example of an initializer test on github...
|
@pogopaule - You would need to create that controller subclass via registration/lookup in the container. Something like: test('it works', function() {
initialize(container, application);
container.register('controller:foo', Ember.Controller.extend({
foo: Ember.computed(function() {
return this.t('foo');
});
}));
var fooInstance = container.lookup('controller:foo');
equal(fooInstance.get('foo'), 'bar');
}); |
@rwjblue: Thanks for your quick reply! That is what I already tried. Forgot to mention this properly. Sorry for that! I figured out that the problem is in these two lines. So is this a mistake in the blueprint or is there a good reason for a separate container? Shouldn't this rather be |
Yes, it is a bug (I submitted a PR for it a few days back: ember-cli/ember-cli#2582). |
Ok, I guess #14 is done now. What do you think? Shall I squash the commits? |
nice :) Yes, please squash |
- Adds tests for controllers, routes, models and components - Fixes bug: In the initializer there is a typo that prevents t from being injected into models. This bug needs to be fixed, otherwise the test for the models fails. #14
Done |
Add tests as specified in #14
Awesome, thank you! |
Thanks for the merge. Glad I could help. And thank you for the project. Helps me a lot :) |
This PR adds tests for controller, route, model and component; the places t gets injected in so far.
Note that this PR also fixes a bug. T didn't get injected in model.