angular.module('application')
.config(function ($stateProvider, $urlRouterProvider) {
'use strict';
function getTemplate(templateName) {
return 'modules/' + templateName + '/template.html';
}
$urlRouterProvider.
otherwise('/login');
$stateProvider
.state('main', {
abstract: true,
views: {
'': {
templateUrl: getTemplate('layouts/public')
},
'footer@main': {
templateUrl: getTemplate('footer'),
controller: 'FooterController'
}
}
})
.state('main.login', {
url: '/login',
templateUrl: getTemplate('login'),
controller: 'LoginController'
});
}
);
describe('Routers', function () {
"use strict";
var state, rootScope;
beforeEach(function () {
module('application');
inject(function ($rootScope, $state) {
rootScope = $rootScope;
state = $state;
});
});
describe('login state', function () {
beforeEach(inject(function ($httpBackend) {
$httpBackend.expectGET('modules/layouts/public/template.html')
.respond(200, 'main HTML');
$httpBackend.expectGET('modules/footer/template.html')
.respond(200, 'main HTML');
$httpBackend.expectGET('modules/login/template.html')
.respond(200, 'main HTML');
}));
it('main.login state controller should be LoginController', function () {
state.go('main.login');
rootScope.$digest();
console.log(state.current);
expect(state.current.controller).toBe('LoginController')
});
})
});
Object{name: '', url: '^', views: null, abstract: true}
Expected undefined to be 'LoginController'.
Error: Expected undefined to be 'LoginController'.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/XsLDAScnQKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.