mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#567 Login Component should emit object not strings
This commit is contained in:
@@ -348,7 +348,7 @@ describe('AlfrescoLogin', () => {
|
||||
expect(component.success).toBe(true);
|
||||
expect(compiled.querySelector('#login-success')).toBeDefined();
|
||||
expect(compiled.querySelector('#login-success').innerHTML).toEqual('LOGIN.MESSAGES.LOGIN-SUCCESS');
|
||||
expect(component.onSuccess.emit).toHaveBeenCalledWith({value: 'Login OK'});
|
||||
expect(component.onSuccess.emit).toHaveBeenCalledWith(true);
|
||||
});
|
||||
|
||||
it('should emit onError event after the login has failed', () => {
|
||||
@@ -379,7 +379,7 @@ describe('AlfrescoLogin', () => {
|
||||
expect(component.success).toBe(false);
|
||||
expect(compiled.querySelector('#login-error')).toBeDefined();
|
||||
expect(compiled.querySelector('#login-error').innerText).toEqual('LOGIN.MESSAGES.LOGIN-ERROR');
|
||||
expect(component.onError.emit).toHaveBeenCalledWith({value: 'Login KO'});
|
||||
expect(component.onError.emit).toHaveBeenCalledWith('Fake server error');
|
||||
});
|
||||
|
||||
it('should render the password in clear when the toggleShowPassword is call', () => {
|
||||
|
@@ -108,15 +108,11 @@ export class AlfrescoLoginComponent {
|
||||
.subscribe(
|
||||
(token: any) => {
|
||||
this.success = true;
|
||||
this.onSuccess.emit({
|
||||
value: 'Login OK'
|
||||
});
|
||||
this.onSuccess.emit(token);
|
||||
},
|
||||
(err: any) => {
|
||||
this.error = true;
|
||||
this.onError.emit({
|
||||
value: 'Login KO'
|
||||
});
|
||||
this.onError.emit(err);
|
||||
console.log(err);
|
||||
this.success = false;
|
||||
},
|
||||
|
Reference in New Issue
Block a user