mardi 23 décembre 2014

Pass a model into a component test in ember

I have a component that requires an instance of a model. The model name is WorkflowState. How do I create an instance of workflowstate and inject into the component.


I need to create the workflow state using:



WorkflowState.create('some data')


because the constructor has some logic that need to run.


I cannot get to WorkflowState. I tried adding an import statement like this



import WorkflowState from "../../../app/models/wokrflow-state";


but that didn't compile...


Any idea how I can do that?


My test looks something like this:



var stateString = 'some data';
var state = WorkflowState.create(JSON.parse(stateString));

var component = this.subject({
workflow: {state: state}
});
// do some testing on the component


Help please. Thanks.





Aucun commentaire:

Enregistrer un commentaire