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(''); } }
Comments
Post a Comment