lundi 5 juin 2017

Testing Ember Mixin - as Controller

I basically have Mixin:

export default Ember.Mixin.create({}};

I use it like this:

export default Ember.Controller.extend(EditControllerMixin, {...});

Everything works fine in application.

However what I want to do and not sure how to go about is to write tests something like this:

const ctrl = Ember.Controller.extend(MyMixin, {...}).create();
ctrl.actions.someAction();
// assert if behaving as expected

The problem is that currently I have trouble with injections as needs: [...] does not take effect, since I am creating controller dynamically, so I guess no Ember container is present, that's why. Also this.get() does not work. So I basically want to create dynamic controller and integrate it into Ember runtime. Hoping for some complete examples.

Thanks.

Aucun commentaire:

Enregistrer un commentaire