-
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(manual-validation): update status after manual update of errors
- Loading branch information
1 parent
060749f
commit 0239e1b
Showing
2 changed files
with
33 additions
and
5 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 |
---|---|---|
@@ -1,8 +1,22 @@ | ||
/** | ||
* Dummy test | ||
*/ | ||
describe('Dummy test', () => { | ||
it('works if true is truthy', () => { | ||
expect(true).toBeTruthy() | ||
import { FormControl } from '../src' | ||
import { NOT_EMPTY_ERROR } from '../src/validators' | ||
|
||
describe('Abstract control', () => { | ||
describe('Manual validation', () => { | ||
it('invalid if error was set', () => { | ||
const control = new FormControl('') | ||
control.setError({ code: NOT_EMPTY_ERROR }) | ||
expect(control.invalid).toBeTruthy() | ||
}) | ||
it('valid if only error was removed', () => { | ||
const control = new FormControl('') | ||
control.setError({ code: NOT_EMPTY_ERROR }) | ||
control.removeError({ code: NOT_EMPTY_ERROR }) | ||
console.log(control.status, control.errors) | ||
expect(control.valid).toBeTruthy() | ||
}) | ||
}) | ||
}) |