What would be your approach to testing this angular testing directive?
$scope.cancel = function () {
$('#pp_bsktexit').modal('show');
};
Something similar to this can be tested, but it doesn't seem too complex:
var nextScreenPath = 'C_HIST';
$scope.goBack = function() {
//sessionService.save($scope.sessionData);
$location.path(nextScreenPath);
}
And the test case:
it('should return location path as nextScreenPath', function(){
var nextScreenPath = 'C_HIST';
expect($location.path()).toEqual('');
scope.goBack();
expect($location.path()).toEqual('/' + nextScreenPath);
});
I'm struggling to apply the same logic/knowledge to test the original directive. Any suggestions? Do I need to mock something?