-
Notifications
You must be signed in to change notification settings - Fork 91
Documentation of componentOutputs
looks not enough.
#368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm reading the source code and found my understanding of this API is wrong. |
Completely works well. describe('componentOutputs', () => {
it('invokes given callback when an output is emitted', async () => {
@Component({ template: `` })
class TestFixtureComponent {
@Output() event = new EventEmitter<void>();
emitEvent() {
this.event.emit();
}
}
const mockEmitter = new EventEmitter<void>();
const spy = jest.spyOn(mockEmitter, 'emit');
const { fixture } = await render(TestFixtureComponent, {
componentOutputs: { event: mockEmitter },
});
fixture.componentInstance.emitEvent();
expect(spy).toHaveBeenCalled();
});
}); |
But, I have no idea why this is needed. What is the difference between |
After diving deeply, I found the answer.
I feel the current documentation is not enough to tell the proper API usage to the users. At least, I'd like to improve the documentation of |
render
with componentOutputs
is not correctly inferredcomponentOutputs
looks not enough.
Hey @lacolaco you're 100% right. Do you think these changes are worth it to deprecate |
@timdeschryver Thanks for clarifying. I can totally agree with you. I think it is not easy to drop |
We'll see how it goes and we can re-evaluate later. |
@timdeschryver I've submitted a PR! #372 |
Summary
When
render(ComponentType)
includescomponentOutputs
in its option, TypeScript inference seems broken.Repro
BTW, I'm preparing a bugfix for this. This is a spec to reproduce the bug.
The text was updated successfully, but these errors were encountered: