How do you testing angular controller with external library usage such as google analytic event tracking. For example:
$scope.showVolumn = function() {
ga('send', {
'hitType': 'event',
'eventCategory': 'Volume',
'eventAction': 'click',
'eventLabel': 'Interaction'
});
if($scope.native !== 'true')
vm.showVolumnCtl = !vm.showVolumnCtl;
};
Run thought my test code this error appeard
ReferenceError: Can't find variable: ga
I don't think you can inject ga in the beforeEach right? Any solution i can overcome this?
Aucun commentaire:
Enregistrer un commentaire