diff --git a/modules/articles/client/config/articles-admin.client.routes.js b/modules/articles/client/config/articles-admin.client.routes.js
index db45758c12..b493d0e0c4 100644
--- a/modules/articles/client/config/articles-admin.client.routes.js
+++ b/modules/articles/client/config/articles-admin.client.routes.js
@@ -15,7 +15,7 @@
template: ''
})
.state('admin.articles.list', {
- url: '/',
+ url: '',
templateUrl: '/modules/articles/client/views/admin/list-articles.client.view.html',
controller: 'ArticlesAdminListController',
controllerAs: 'vm',
diff --git a/modules/articles/tests/client/admin.articles.client.controller.tests.js b/modules/articles/tests/client/admin.articles.client.controller.tests.js
index 235a32c93f..32964a8fe3 100644
--- a/modules/articles/tests/client/admin.articles.client.controller.tests.js
+++ b/modules/articles/tests/client/admin.articles.client.controller.tests.js
@@ -48,6 +48,9 @@
ArticlesService = _ArticlesService_;
Notification = _Notification_;
+ // Ignore parent template get on state transitions
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200, '');
+
// create mock article
mockArticle = new ArticlesService({
_id: '525a8422f6d0f87f0e407a33',
diff --git a/modules/articles/tests/client/admin.list.articles.client.controller.tests.js b/modules/articles/tests/client/admin.list.articles.client.controller.tests.js
index d22f13a211..90bd19f1a6 100644
--- a/modules/articles/tests/client/admin.list.articles.client.controller.tests.js
+++ b/modules/articles/tests/client/admin.list.articles.client.controller.tests.js
@@ -46,6 +46,10 @@
Authentication = _Authentication_;
ArticlesService = _ArticlesService_;
+ // Ignore parent template get on state transitions
+ $httpBackend.whenGET('/modules/articles/client/views/list-articles.client.view.html').respond(200, '');
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200, '');
+
// create mock article
mockArticle = new ArticlesService({
_id: '525a8422f6d0f87f0e407a33',
diff --git a/modules/articles/tests/client/articles.client.routes.tests.js b/modules/articles/tests/client/articles.client.routes.tests.js
index 5171226dae..7b724a5c53 100644
--- a/modules/articles/tests/client/articles.client.routes.tests.js
+++ b/modules/articles/tests/client/articles.client.routes.tests.js
@@ -109,7 +109,9 @@
});
describe('Handle Trailing Slash', function () {
- beforeEach(inject(function ($state, $rootScope) {
+ beforeEach(inject(function ($state, $rootScope, $templateCache) {
+ $templateCache.put('/modules/articles/client/views/list-articles.client.view.html', '');
+
$state.go('articles.list');
$rootScope.$digest();
}));
diff --git a/modules/articles/tests/client/list-articles.client.controller.tests.js b/modules/articles/tests/client/list-articles.client.controller.tests.js
index 248862298d..b5e37c9f62 100644
--- a/modules/articles/tests/client/list-articles.client.controller.tests.js
+++ b/modules/articles/tests/client/list-articles.client.controller.tests.js
@@ -78,6 +78,8 @@
// Set POST response
$httpBackend.expectGET('/api/articles').respond(mockArticleList);
+ // Ignore parent template get on state transition
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200, '');
$httpBackend.flush();
diff --git a/modules/chat/tests/client/chat.client.controller.tests.js b/modules/chat/tests/client/chat.client.controller.tests.js
index 50139f689b..693ceb3bdb 100644
--- a/modules/chat/tests/client/chat.client.controller.tests.js
+++ b/modules/chat/tests/client/chat.client.controller.tests.js
@@ -11,7 +11,8 @@
ChatController,
$timeout,
$state,
- Authentication;
+ Authentication,
+ $httpBackend;
// Load the main application module
beforeEach(module(ApplicationConfiguration.applicationModuleName));
@@ -39,12 +40,17 @@
});
describe('when user logged in', function () {
- beforeEach(inject(function ($controller, $rootScope, _Socket_, _Authentication_, _$timeout_, _$state_) {
+ beforeEach(inject(function ($controller, $rootScope, _$httpBackend_, _Socket_, _Authentication_, _$timeout_, _$state_) {
Authentication.user = {
name: 'user',
roles: ['user']
};
+ $httpBackend = _$httpBackend_;
+
+ // Ignore parent template get on state transitions
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200, '');
+
ChatController = $controller('ChatController as vm', {
$scope: $scope
});
diff --git a/modules/chat/tests/client/chat.client.routes.tests.js b/modules/chat/tests/client/chat.client.routes.tests.js
index 47827db778..2f16e8db26 100644
--- a/modules/chat/tests/client/chat.client.routes.tests.js
+++ b/modules/chat/tests/client/chat.client.routes.tests.js
@@ -4,7 +4,8 @@
describe('Chat Route Tests', function () {
// Initialize global variables
var $scope,
- Authentication;
+ Authentication,
+ $httpBackend;
// We can start by loading the main application module
beforeEach(module(ApplicationConfiguration.applicationModuleName));
@@ -39,17 +40,25 @@
});
describe('Handle Trailing Slash', function () {
- beforeEach(inject(function ($state, $rootScope, _Authentication_) {
+ beforeEach(inject(function ($state, $rootScope, _$httpBackend_, _Authentication_) {
Authentication.user = {
name: 'user',
roles: ['user']
};
+ $httpBackend = _$httpBackend_;
+
+ // Ignore parent template get on state transition
+ $httpBackend.whenGET('/modules/chat/client/views/chat.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200, '');
+
$state.go('chat');
$rootScope.$digest();
}));
- it('Should remove trailing slash', inject(function ($state, $location, $rootScope) {
+ it('Should remove trailing slash', inject(function ($state, $location, $rootScope, $templateCache) {
+ $templateCache.put('/modules/chat/client/views/chat.client.view.html', '');
+
$location.path('chat/');
$rootScope.$digest();
diff --git a/modules/users/tests/client/authentication.client.controller.tests.js b/modules/users/tests/client/authentication.client.controller.tests.js
index 572abe9b48..f2e99e1fec 100644
--- a/modules/users/tests/client/authentication.client.controller.tests.js
+++ b/modules/users/tests/client/authentication.client.controller.tests.js
@@ -47,6 +47,10 @@
spyOn(Notification, 'error');
spyOn(Notification, 'success');
+ // Ignore parent template get on state transitions
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/400.client.view.html').respond(200);
+
// Initialize the Authentication controller
AuthenticationController = $controller('AuthenticationController as vm', {
$scope: scope
@@ -54,7 +58,9 @@
}));
describe('$scope.signin()', function () {
- it('should login with a correct username and password', function () {
+ it('should login with a correct user and password', inject(function ($templateCache) {
+ $templateCache.put('/modules/core/client/views/home.client.view.html', '');
+
// Test expected GET request
$httpBackend.when('POST', '/api/auth/signin').respond(200, { username: 'Fred' });
@@ -64,11 +70,12 @@
// Test scope value
expect(scope.vm.authentication.user.username).toEqual('Fred');
expect($location.url()).toEqual('/');
- });
+ }));
- it('should login with a correct email and password', function () {
+ it('should login with a correct email and password', inject(function ($templateCache) {
+ $templateCache.put('/modules/core/client/views/home.client.view.html', '');
// Test expected GET request
- $httpBackend.when('POST', 'api/auth/signin').respond(200, { email: 'Fred@email.com' });
+ $httpBackend.when('POST', '/api/auth/signin').respond(200, { email: 'Fred@email.com' });
scope.vm.signin(true);
$httpBackend.flush();
@@ -76,7 +83,7 @@
// Test scope value
expect(scope.vm.authentication.user.email).toEqual('Fred@email.com');
expect($location.url()).toEqual('/');
- });
+ }));
it('should be redirected to previous state after successful login',
inject(function (_$state_) {
@@ -136,7 +143,9 @@
});
describe('$scope.signup()', function () {
- it('should register with correct data', function () {
+ it('should register with correct data', inject(function ($templateCache) {
+ $templateCache.put('/modules/core/client/views/home.client.view.html', '');
+
// Test expected GET request
scope.vm.authentication.user = 'Fred';
$httpBackend.when('POST', '/api/auth/signup').respond(200, { username: 'Fred' });
@@ -148,7 +157,7 @@
expect(scope.vm.authentication.user.username).toBe('Fred');
expect(Notification.success).toHaveBeenCalledWith({ message: ' Signup successful!' });
expect($location.url()).toBe('/');
- });
+ }));
it('should fail to register with duplicate Username', function () {
// Test expected POST request
diff --git a/modules/users/tests/client/edit-profile.client.controller.tests.js b/modules/users/tests/client/edit-profile.client.controller.tests.js
index fcb73bafcc..e608a1bb45 100644
--- a/modules/users/tests/client/edit-profile.client.controller.tests.js
+++ b/modules/users/tests/client/edit-profile.client.controller.tests.js
@@ -51,6 +51,10 @@
spyOn(Notification, 'error');
spyOn(Notification, 'success');
+ // Ignore parent template gets on state transition
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/400.client.view.html').respond(200);
+
// Mock logged in user
Authentication.user = {
_id: '525a8422f6d0f87f0e407a33',
diff --git a/modules/users/tests/client/password.client.controller.tests.js b/modules/users/tests/client/password.client.controller.tests.js
index da4f61b855..3bb87cc588 100644
--- a/modules/users/tests/client/password.client.controller.tests.js
+++ b/modules/users/tests/client/password.client.controller.tests.js
@@ -40,6 +40,9 @@
$location = _$location_;
$location.path = jasmine.createSpy().and.returnValue(true);
+ // Ignore parent template gets on state transition
+ $httpBackend.whenGET('/modules/core/client/views/404.client.view.html').respond(200);
+
// Mock logged in user
_Authentication_.user = {
username: 'test',
@@ -74,6 +77,10 @@
spyOn(Notification, 'error');
spyOn(Notification, 'success');
+ // Ignore parent template gets on state transition
+ $httpBackend.whenGET('/modules/core/client/views/404.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/400.client.view.html').respond(200);
+
// Initialize the Authentication controller
PasswordController = $controller('PasswordController as vm', {
$scope: scope
diff --git a/modules/users/tests/client/users-admin.client.routes.tests.js b/modules/users/tests/client/users-admin.client.routes.tests.js
index 996e6470b1..20348adf1e 100644
--- a/modules/users/tests/client/users-admin.client.routes.tests.js
+++ b/modules/users/tests/client/users-admin.client.routes.tests.js
@@ -4,7 +4,8 @@
describe('Users Admin Route Tests', function () {
// Initialize global variables
var $scope,
- Authentication;
+ Authentication,
+ $httpBackend;
// We can start by loading the main application module
beforeEach(module(ApplicationConfiguration.applicationModuleName));
@@ -77,17 +78,26 @@
});
describe('Handle Trailing Slash', function () {
- beforeEach(inject(function ($state, $rootScope, _Authentication_) {
+ beforeEach(inject(function ($state, $rootScope, _Authentication_, _$httpBackend_) {
Authentication.user = {
name: 'user',
roles: ['admin']
};
+ $httpBackend = _$httpBackend_;
+
+ // Ignore parent template gets on state transition
+ $httpBackend.whenGET('/modules/users/client/views/admin/list-users.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200);
+
$state.go('admin.users');
$rootScope.$digest();
}));
- it('Should remove trailing slash', inject(function ($state, $location, $rootScope) {
+ it('Should remove trailing slash', inject(function ($state, $location, $rootScope, $templateCache) {
+ $templateCache.put('/modules/users/client/views/admin/list-users.client.view.html', '');
+ $templateCache.put('/modules/core/client/views/home.client.view.html', '');
+
$location.path('admin/users/');
$rootScope.$digest();
diff --git a/modules/users/tests/client/users.client.routes.tests.js b/modules/users/tests/client/users.client.routes.tests.js
index 75f9e11dd4..bd8239811b 100644
--- a/modules/users/tests/client/users.client.routes.tests.js
+++ b/modules/users/tests/client/users.client.routes.tests.js
@@ -4,7 +4,8 @@
describe('Users Route Tests', function () {
// Initialize global variables
var $scope,
- Authentication;
+ Authentication,
+ $httpBackend;
// We can start by loading the main application module
beforeEach(module(ApplicationConfiguration.applicationModuleName));
@@ -115,17 +116,27 @@
});
describe('Handle Trailing Slash', function () {
- beforeEach(inject(function ($state, $rootScope, _Authentication_) {
+ beforeEach(inject(function ($state, $rootScope, _Authentication_, _$httpBackend_) {
Authentication.user = {
name: 'user',
roles: ['user']
};
+ $httpBackend = _$httpBackend_;
+
+ // Ignore parent template gets on state transitions
+ $httpBackend.whenGET('/modules/users/client/views/settings/settings.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/core/client/views/home.client.view.html').respond(200);
+ $httpBackend.whenGET('/modules/users/client/views/settings/edit-profile.client.view.html').respond(200);
+
$state.go('settings.profile');
$rootScope.$digest();
}));
- it('Should remove trailing slash', inject(function ($state, $location, $rootScope) {
+ it('Should remove trailing slash', inject(function ($state, $location, $rootScope, $templateCache) {
+ $templateCache.put('/modules/users/client/views/settings/settings.client.view.html', '');
+ $templateCache.put('/modules/users/client/views/settings/edit-profile.client.view.html', '');
+
$location.path('settings/profile/');
$rootScope.$digest();