I have the controller code:
$scope.$on('load', function (event) {
$scope.getData();
event.stopPropagation();
});
and the test code:
it('$on load', function(event) {
var controller=createController();
spyOn(scope, '$on').andCallThrough();// I have also tried to spy scope getData
scope.$broadcast('load');
expect(scope.$on).toHaveBeenCalledwith("load");
});
TypeError: event.stopPropagation is not a function
How can I define the parameters in the call from the Unit test?
Aucun commentaire:
Enregistrer un commentaire