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
Hi,
I integrated V3.0.0 of ngx-currency with our company project (the latest version is not compatible with the Angular version we are using). I am trying to write unit tests to prove that out input box won't take the invalid value after having currencyMask added. The Input box is 2-way binding to variable "costInfo" using ngModel. I tried the manual tests, and everything looks good.
However, in unit test,
I tried
inputBox.value = '100.00'; //(this is a valid input value)
inputBox.dispatchEvent(new Event('input', { bubbles: true }));
May I ask how to write the correct unit tests for input element with currencyMask? Thank you
The text was updated successfully, but these errors were encountered:
JoeyWu123
changed the title
inputBox.dispatchEvent(new Event('input', { bubbles: true })) doesn't work after inputting NgxCurrencyModule in Unit Test
inputBox.dispatchEvent(new Event('input', { bubbles: true })) doesn't work after importing NgxCurrencyModule in Unit Test
Jul 29, 2024
I think you should change the value of ngModel instead of working with input.value directly. Or you can simulate keyboard input by sending KeyDown and KeyUp events.
Hi,
I integrated V3.0.0 of ngx-currency with our company project (the latest version is not compatible with the Angular version we are using). I am trying to write unit tests to prove that out input box won't take the invalid value after having currencyMask added. The Input box is 2-way binding to variable "costInfo" using ngModel. I tried the manual tests, and everything looks good.
However, in unit test,
I tried
the costInfo doesn't change. I already add
the issue is still same
However, if I remove NgxCurrencyModule from
costInfo is successfully changed.
May I ask how to write the correct unit tests for input element with currencyMask? Thank you
The text was updated successfully, but these errors were encountered: