-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying the implementation of dynamic aria-describedby
(cherry picked from commit fa6e85d)
- Loading branch information
1 parent
67cd8a9
commit 45b6f25
Showing
3 changed files
with
2 additions
and
63 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 |
---|---|---|
|
@@ -210,39 +210,4 @@ describe('RegisterEmailFormComponent', () => { | |
expect(router.navigate).not.toHaveBeenCalled(); | ||
})); | ||
}); | ||
describe('ariaDescribedby', () => { | ||
it('should have required error message when email is empty', () => { | ||
comp.form.patchValue({ email: '' }); | ||
comp.checkEmailValidity(); | ||
|
||
expect(comp.ariaDescribedby).toContain('email-errors-required'); | ||
}); | ||
|
||
it('should have invalid email error message when email is invalid', () => { | ||
comp.form.patchValue({ email: 'invalid-email' }); | ||
comp.checkEmailValidity(); | ||
|
||
expect(comp.ariaDescribedby).toContain('email-error-not-valid'); | ||
}); | ||
|
||
it('should clear ariaDescribedby when email is valid', () => { | ||
comp.form.patchValue({ email: '[email protected]' }); | ||
comp.checkEmailValidity(); | ||
|
||
expect(comp.ariaDescribedby).toBe(''); | ||
}); | ||
|
||
it('should update ariaDescribedby on value changes', () => { | ||
spyOn(comp, 'checkEmailValidity').and.callThrough(); | ||
|
||
comp.form.patchValue({ email: '' }); | ||
expect(comp.ariaDescribedby).toContain('email-errors-required'); | ||
|
||
comp.form.patchValue({ email: 'invalid-email' }); | ||
expect(comp.ariaDescribedby).toContain('email-error-not-valid'); | ||
|
||
comp.form.patchValue({ email: '[email protected]' }); | ||
expect(comp.ariaDescribedby).toBe(''); | ||
}); | ||
}); | ||
}); |
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