Question about unittesting a directive with HostListener(keydown) #390
Unanswered
revenger1986
asked this question in
Q&A
Replies: 1 comment
-
Hi there! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm submitting a...
Current behavior
I'm not here to report an issue, but I was hoping that someone could point me in the correct direction.
At the moment i'm trying to make a unit test for a custom directive which has a Hostlistener(keydown).
So this is a simplified version of the HostListener in my directive.
In my unittest (i'm using jest and ofc specator) i try to do this.
When running the unit test the value of the spectator.element is still the initial value 0. I understand that this hostlistener is not changing the value directly, but I was expecting that when the code didn't hit the event.preventDefault() the value of the input would still change.
How would you advice me to test this?
Environment
Beta Was this translation helpful? Give feedback.
All reactions