-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(package): added and fixed register comp. spec #323
- Loading branch information
1 parent
980385c
commit e8d9d4f
Showing
2 changed files
with
12 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,25 +106,28 @@ describe('NgxAuthFirebaseuiRegisterComponent', () => { | |
expect(errors['required']).toBeFalsy(); | ||
}); | ||
|
||
it('login form validity', () => { | ||
it('register form validity', () => { | ||
expect(component.registerForm.valid).toBeFalsy(); | ||
component.registerForm.controls['name'].setValue('Test XYZ'); | ||
component.registerForm.controls['email'].setValue('[email protected]'); | ||
component.registerForm.controls['password'].setValue('123456789'); | ||
component.registerForm.controls['passwordConfirm'].setValue('123456789'); | ||
expect(component.registerForm.valid).toBeTruthy(); | ||
}); | ||
|
||
it('should login button be disabled if the login form is invalid', () => { | ||
const loginButton: DebugElement = fixture.debugElement.query(By.css('#loginButton')); | ||
expect(loginButton.nativeElement.disabled).toBeTruthy(); | ||
console.log('loginButton', loginButton); | ||
it('should create account button be disabled if the register form is invalid', () => { | ||
const createAccountButton: DebugElement = fixture.debugElement.query(By.css('#createAccountButton')); | ||
expect(createAccountButton.nativeElement.disabled).toBeTruthy(); | ||
}); | ||
|
||
it('should create button be enabled if the register form is valid', () => { | ||
const loginButton: DebugElement = fixture.debugElement.query(By.css('#loginButton')); | ||
const createAccountButton: DebugElement = fixture.debugElement.query(By.css('#createAccountButton')); | ||
component.registerForm.controls['name'].setValue('Test XYZ'); | ||
component.registerForm.controls['email'].setValue('[email protected]'); | ||
component.registerForm.controls['password'].setValue('123456789'); | ||
component.registerForm.controls['passwordConfirm'].setValue('123456789'); | ||
fixture.detectChanges(); | ||
expect(loginButton.nativeElement.disabled).toBeFalsy(); | ||
expect(createAccountButton.nativeElement.disabled).toBeFalsy(); | ||
}); | ||
|
||
}); |