Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

What would be a proper way to test signal based output event emitters? #442

Answered by timdeschryver
italosll asked this question in Q&A
Discussion options

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.

You must be logged in to vote

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

Comment options

See #443

You must be logged in to vote
2 replies
Comment options

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.

Comment options

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.

Answer selected by italosll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /