-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix client-side tests after removing <base/>
Fixes the client-side tests after the removal of the <base/> tag from the main layout. These fixes aren't ideal. At the moment, they will suffice. This comment (angular-ui/ui-router#212 (comment)), among others in that issue, led me to choose this method as the fix to avoid having to change any other core code.
- Loading branch information
welcome-dev
committed
Oct 11, 2016
1 parent
8d2ebbc
commit db4962f
Showing
12 changed files
with
87 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,14 +47,20 @@ | |
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 | ||
}); | ||
})); | ||
|
||
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,19 +70,20 @@ | |
// 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: '[email protected]' }); | ||
$httpBackend.when('POST', '/api/auth/signin').respond(200, { email: '[email protected]' }); | ||
|
||
scope.vm.signin(true); | ||
$httpBackend.flush(); | ||
|
||
// Test scope value | ||
expect(scope.vm.authentication.user.email).toEqual('[email protected]'); | ||
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: '<i class="glyphicon glyphicon-ok"></i> Signup successful!' }); | ||
expect($location.url()).toBe('/'); | ||
}); | ||
})); | ||
|
||
it('should fail to register with duplicate Username', function () { | ||
// Test expected POST request | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters