What is the best practice for testing the config
block for an angular module?
Do you unit test the config/run blocks? Or is it better to write e2e tests for testing routes?
angular.module('example')
.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('root', {
abstract: true,
views: {
'': {
templateProvider: function($templateCache) {
return $templateCache.get('views/root.html');
}
}
}
})
.state('login', {
url: '/login',
parent: 'root',
data: {
title: 'Login',
requiresLogin: false,
},
views: {
'login': {
controller: 'LoginCtrl as login',
templateProvider: function($templateCache) {
return $templateCache.get('views/login.html');
}
}
}
});
}
]);
Aucun commentaire:
Enregistrer un commentaire