You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Masks created in Angular cannot be tested via the NativeInputElemet value property or input event either. A simple reactive form cannot be tested if it has a mask, because although the value is displayed in the form control, the value is not displayed in the value property in HTMLInputElement, but the values are displayed in a running application.
In the Console we wrote the native input element value property and it looks like the values are included in it perfectly.
The attached repository includes three types of tests [with karma]: native jasmine, cdk harness, ngneat / spectator. I tried out the extra frameworks because they handle the change detector pretty well. I thought there was a mistake in mismanaging the change detector in the test, but unfortunately that is not true.
In tests I only managed to get a positive result if I patched formControl, but I would like to be able to test the field by writing from an html input page, as if the user were writing ...
Expected behavior
I want the value of HTMLInputElement.value to load well during the test. Or I want to ask for guidance on how to test the inputs properly.
Environment:
OS: all
Browser: all
Version: -
IMask version: 6.1.0
Framework/plugin version if used: angular-imask - 6.1.0
Additional context
The error also occurs in the case of jest.
The text was updated successfully, but these errors were encountered:
not sure it's related to imask itself but I hope somebody helps with it.
you can also test Masked model which is not related to view (control) at all but contains same logic as with user interaction.
Describe the bug
Masks created in Angular cannot be tested via the NativeInputElemet value property or input event either. A simple reactive form cannot be tested if it has a mask, because although the value is displayed in the form control, the value is not displayed in the value property in HTMLInputElement, but the values are displayed in a running application.
To Reproduce
Test repository: https://github.com/eggp/angular-imask-unit-test
Runned app:
{ mask: '{+1(}000{)}000{-}0000', lazy: false }
(https://github.com/eggp/angular-imask-unit-test/blob/master/src/app/app.component.ts#L11).In the Console we wrote the native input element value property and it looks like the values are included in it perfectly.
The attached repository includes three types of tests [with karma]: native jasmine, cdk harness, ngneat / spectator. I tried out the extra frameworks because they handle the change detector pretty well. I thought there was a mistake in mismanaging the change detector in the test, but unfortunately that is not true.
In tests I only managed to get a positive result if I patched formControl, but I would like to be able to test the field by writing from an html input page, as if the user were writing ...
Native jasmine test: https://github.com/eggp/angular-imask-unit-test/blob/master/src/app/app.component.native.spec.ts
CDK Harness test: https://github.com/eggp/angular-imask-unit-test/blob/master/src/app/app.component.harness.spec.ts
ngneat/spectator test: https://github.com/eggp/angular-imask-unit-test/blob/master/src/app/app.component.spectator.spec.ts
Angular version: 11.2.14
Expected behavior
I want the value of HTMLInputElement.value to load well during the test. Or I want to ask for guidance on how to test the inputs properly.
Environment:
Additional context
The error also occurs in the case of jest.
The text was updated successfully, but these errors were encountered: