I have a controller that has a callback inside:
angular.module('controllers').controller('headerController', headerController);
function headerController(headerService) {
var self = this;
headerService.getHeaderContentData()
.then(function(response) {
self.contentData = response.content;
});
}
My problem is that I need to check the value of contentData
in an unit test. The idea is when I call expect(ctrl.contentData).to.be.defined
passes the test, but the value of ctrl.contentData
is undefined
. Is there a way to test this behavior (test the self.contentData when the callback occurs)?
Aucun commentaire:
Enregistrer un commentaire