javascript - How do I assert that an inner function was called with jasmine? -


i have class style declaration javascript in app , need test inner method called.

the structure this....

angular.module("myapp").factory('myclass', ['$rootscope', function (rootscope) {       function active(type) {         //how see if method called if cleartools public method called?     }       return {         active: active,         clearactives: function() {             active('');         }     }  }]); 

how see if function active() called if clearactives() called?

you can checking caller function name, require name functions

function active(type) {     var callername = arguments.callee.caller.name;     if(callername == "clearactives") {         //do     } } return {     active: active,                   //names function     clearactives: function clearactives() {         active('');     } } 

jsfiddle demo


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -