Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mask validate date on form fails tests #811

Closed
theswandog opened this issue Oct 7, 2020 · 1 comment
Closed

mask validate date on form fails tests #811

theswandog opened this issue Oct 7, 2020 · 1 comment

Comments

@theswandog
Copy link

theswandog commented Oct 7, 2020

"@angular/common": "~9.1.12",
"@angular/compiler": "~9.1.12",
"@angular/core": "~9.1.12",
"ngx-mask": "^9.1.4",

I have a form with an input guarded by a mask.
<input type="text" class="form-control" id="dobFilter" formControlName="dobFilter" placeholder="mm/dd/yyyy" mask="m0/d0/0000" [dropSpecialCharacters]="false" />

the test value for 44/44/2020 is seen as valid which is incorrect. this test passed using [email protected]
`fit("validates dob", () => {
let filterValue = { dobFilter: "44" };
component.filterFormGroup.patchValue(filterValue);
expect(component.filterFormGroup.valid).toBeFalsy();

    filterValue = { ...filterValue, dobFilter: "44/44/2020" };
    component.filterFormGroup.patchValue(filterValue);
    expect(component.filterFormGroup.valid).toBeFalsy();

    filterValue = { ...filterValue, dobFilter: "01/02/2020" };
    component.filterFormGroup.patchValue(filterValue);
    expect(component.filterFormGroup.valid).toBeTruthy();
});`
@andriikamaldinov1
Copy link
Collaborator

@theswandog Thank you for using ngx-mask. Please update ngx-mask to latest version.

https://stackblitz.com/edit/angular-ngbh66?file=src%2Fmain.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants