Wie kann ich testen, ob der Bereich nach der Übertragung gefüllt ist? Ich habe hier ein paar QA's im Stackexchange gesucht und gefunden, aber keine hat mein Problem beantwortet. Der Code funktioniert gut, ich weiß nicht, wie ich ihn testen soll. Darf ich hinzufügen, dass ich ein Neuling zum Testen bin und besonders mit Jasmine.
So, hier ist der Code:
Dienst CrappySvc:
update: function() {
$rootScope.$broadcast('updatecrappy', Crappy.query());
}
-Controller GetCrappyCtrl:
$scope.$on('updatecrappy', function(event, crap) {
$scope.crap = crap;
});
Jasmin:
beforeEach(inject(function($rootScope, $httpBackend, $controller, Crappy) {
rootScope = $rootScope;
scope = $rootScope.$new();
Crappy = mockCrappy;
...
spyOn(rootScope, '$broadcast');
...
ctrl = $controller('GetCrappyCtrl', {
$scope : scope,
Crappy : mockCrappy
});
}));
});
Stein
Ich fand das auch hilfreich: http://stackoverflow.com/questions/15272414/how-can-i-test-events-in-angular – Ben