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(component.success).toBe(true);
|
||||||
expect(compiled.querySelector('#login-success')).toBeDefined();
|
expect(compiled.querySelector('#login-success')).toBeDefined();
|
||||||
expect(compiled.querySelector('#login-success').innerHTML).toEqual('LOGIN.MESSAGES.LOGIN-SUCCESS');
|
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', () => {
|
it('should emit onError event after the login has failed', () => {
|
||||||
@@ -379,7 +379,7 @@ describe('AlfrescoLogin', () => {
|
|||||||
expect(component.success).toBe(false);
|
expect(component.success).toBe(false);
|
||||||
expect(compiled.querySelector('#login-error')).toBeDefined();
|
expect(compiled.querySelector('#login-error')).toBeDefined();
|
||||||
expect(compiled.querySelector('#login-error').innerText).toEqual('LOGIN.MESSAGES.LOGIN-ERROR');
|
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', () => {
|
it('should render the password in clear when the toggleShowPassword is call', () => {
|
||||||
|
@@ -108,15 +108,11 @@ export class AlfrescoLoginComponent {
|
|||||||
.subscribe(
|
.subscribe(
|
||||||
(token: any) => {
|
(token: any) => {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
this.onSuccess.emit({
|
this.onSuccess.emit(token);
|
||||||
value: 'Login OK'
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
(err: any) => {
|
(err: any) => {
|
||||||
this.error = true;
|
this.error = true;
|
||||||
this.onError.emit({
|
this.onError.emit(err);
|
||||||
value: 'Login KO'
|
|
||||||
});
|
|
||||||
console.log(err);
|
console.log(err);
|
||||||
this.success = false;
|
this.success = false;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user