javascript - Test binding of a custom event to a callback function with Backbone and Jasmine -
I am trying to test to make sure a custom event is bound to show a dialog here The code is:
setupListener = function () {appEvent.on ('some_event', theHandler); }; TheHandler = function (feedbackdata) {....}; This.show = function () {setupListener (); };
Note: setupListener is a private function. This is my test code that works:
This was called 'appEvent.on,' function (spyOn (appEvent, 'on'); dialogView.show (); Var theHandler = function (feedbackdata) {....}; Hopefully (AppAnt.On) .Thovi Bin Callold ('Some Documents', Handler);});
But now I have called the "on" function with the correct parameter, I want to see it:
this ('appEvent.on correct Standards were called together, function () {spyOn (appEvent, 'on'); dialogView.show (); var theHandler = function (responseData) {....}; Hopefully (appEvent.on) .tohaveBeenCalledWith ('Some_event', theHandler);});
But I get an error:
The problem appears with the controller How do I check the "on" function with the handler?
You have a handler function such as:
Expect (appEvent.on) .toHaveBeenCalledWith ('some_event', jasmine.any (theHandler));
Comments
Post a Comment