-
Notifications
You must be signed in to change notification settings - Fork 94
What would be a proper way to test signal based output event emitters? #442
-
I dont know how to test output signal based outputs on angular, i find the documentation for input based on signals but not for output, there is a proper way to do this now? thanks.
Beta Was this translation helpful? Give feedback.
All reactions
This is (sadly) the intended behavior.
The reason of this difference is that we used Angular's setInput
method to set the input value, this method takes the alias into account.
For Output
properties this doesn't exist, and we simply update the property within the component.
If there's a way to also use the Output alias, I would be happy to update it on our side.
Replies: 1 comment 2 replies
-
See #443
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
First, sorry about the late answer, second, thank you very much, that's helpful. I only like to question about the usage of signals inputs and outputs with alias, while signals inputs on the function render of testing library needed to be pass using alias, signals outputs seems to required the inverse, to be passed whitout using alias. Is this the intended behavior?
take the following example:
lets say that i have a component with:
A signal input "name" that uses the alias "name$$" and
A signal output "event" that uses the alias "event$$"
so, in the render of testing library, i would pass the input like:
componentInputs: { name:"the intended name here" }
but, to pass a mock to the output i would need to pass like:
componentOutputs:{ event$$: jest.fn() }
Is this the intended behavior? use the alias in the input parameter but not in the output? thank you again.
Beta Was this translation helpful? Give feedback.
All reactions
-
This is (sadly) the intended behavior.
The reason of this difference is that we used Angular's setInput
method to set the input value, this method takes the alias into account.
For Output
properties this doesn't exist, and we simply update the property within the component.
If there's a way to also use the Output alias, I would be happy to update it on our side.
Beta Was this translation helpful? Give feedback.