Tagged Questions
4
votes
1answer
620 views
What is the best approach to test events in angular?
How can i test for events in angular js?
I need to test the following code, but I have little experience testing.
I figured i need to use spies in some way to see if events have fired or something, ...
11
votes
1answer
4k views
AngularJS controller unit tests - injecting services
A hopefully simple question about AngularJS unit testing. I have a controller using a simple service (adapted from angular-seed project)
services.js:
angular.module('myApp.services', ...
1
vote
4answers
919 views
Jasmine tests AngularJS Directives with templateUrl
I'm writing directive tests for AngularJS with Jasmine, and using templateUrl with them: https://gist.github.com/tanepiper/62bd10125e8408def5cc
However, when I run the test I get the error included ...
3
votes
1answer
857 views
in angular js while testing the controller got Unknown provider
I have the following controller:
angular.module('samples.controllers',[])
.controller('MainCtrl', ['$scope', 'Samples', function($scope, Samples){
//Controller code
}
Which dependent on the ...
3
votes
1answer
1k views
What's wrong with Angular service test?
I've got a service calling external web service:
angular.module('myApp.services', [])
.service('autoCmpltDataSvc', function ($http) {
var innerMatch = function (data) {
return $.map(data, ...
2
votes
2answers
808 views
Angularjs promise not being resolved in unit test
I am using jasmine to unit test an angularjs controller that sets a variable on the scope to the result of calling a service method that returns a promise object:
var MyController = function($scope, ...
1
vote
1answer
654 views
angularjs - testing controller
I am just starting with angular and I wanted to write some simple unit tests for my controllers, here is what I got.
app.js:
'use strict';
// Declare app level module which depends on filters, and ...
4
votes
2answers
164 views
Testing directives that uses templates
How can i unit test directives that use templateUrl to load templates?
Since $httpBackend is a mock, it will not load templates either.
I would like to be able to use something like
...