I'm having two problems with this trial. First of all, I am trying to establish a path parameter of 1 because in my controller, it will only call the loadJob method if the path .Param.id will be set. When I console.log the $ routesParams.id in the controller during testing, it essentially writes. So, I'm not sure why the passage parameters are not being tested in the controller.
Secondly, if I check the paragraph on the path and only call it the $ radius, LoadJob, the spy fails. Any ideas which I'm doing wrong here?
spec -
Description ('ApplyController', function) (var httpBackend, scope, job; before before every (module (Http: // workboward) Proper job loads', function) (first) (inject (function ($ Rootscope, $ controller, $ httpBackend, $ http, $ q, $ upload, $ log, template) {httpBackend = $ HttpBackend; scope = $ rootScope $ New (); Job = {id: 1, Status title: 'test'}; httpBackend.when ('GET', templates.apiUrl + '/ job / 1').); $ Controller ('Job Controller' , {$ Area: area, $ route mercury: {id: 1}, $ http: $ http, $ q: $ q, $ upload: $ upload, $ log: $ log, templates: template }); Detective (scope ',' loadjob ');})) (' Call loads when id path parameter is provided ', function () {httpBackend.flush ()); Scope $ digest (). Hope (scope.loadJob) .toHaveBeenCalled (); })})})
Controller ...
Angular Modules ('Jobbord') The controller ('ApplyController', ['$ scope', '$ route', '$ http', '$ q', '$ upload', '$ log', 'template', function ($ radius, $ route perm, $ Http, $ q, $ upload, $ log, templates) {$ scope.job = {}; $ scope.pageTitle = ''; $ scope.jobId = 0; $ scope.loadJob = function () {var deferred = $ Q.defer (); $ http.get (templates.ipiurl + '/ job /' + $ routepram.id) .vivet (function) {$ scope.job = data; $ radius.page title = $ scope .job.position_title; $ scope.jobId = $ field .job.id; deferred.resolve (data);}) returns; promos;} if ($ routeParams.id) {$ scope.loadJob ();} }];
No comments:
Post a Comment