ember.js - Mocking models for testing Ember.easyForms input component inside another ember component -


i using ember-cli qunit testing using moduleforcomponent. have following select element inside ember component have created.

        {{input site as="select"             collection="sites"             selection="site"             optionlabelpath="content.sitelabel"             optionvaluepath="content.id"             prompt="please select"             label=" "         }} 

the actual sites collection found using store.

sites : function() {     return this.get('store').find('site'); }.property() 

i using jsmockito mock out store.

var sitemock = mock(ds.model); when(sitemock).get('id').thenreturn(1); when(sitemock).get('sitelabel').thenreturn('qunit');  var storemock = mock(ds.store); when(storemock).find('site').thenreturn([sitemock]); 

i pass components parameter in test.

var component = this.subject({     store : storemock }); 

the generated html looks this, seems sitemock has rendered optionlabelpath , optionvalupath did not work correctly though have added appropriate expectations on mock.

<select id="ember473" class="ember-view ember-select">     <option value="">please select</option>     <option id="ember491" class="ember-view" value=""></option> </select> 

i have tested using getters on sitemock in debugger , working expected. guess need when condition on property of sitemock not sure what. can give me advice on getting working?

the problem seems using content. in paths optionlabelpath="content.sitelabel" thinking controller proxing model.

but test using models directly -undecorated controller- , not have content property.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -