-
Notifications
You must be signed in to change notification settings - Fork 92
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
Support on
with render
that receive an template
#470
Comments
this issue is also present when using inputs not only outputs @timdeschryver |
When providing a template rather than a component type, the @timdeschryver I don't think it would be useful to support I'd propose to only work with --> imo the it('template test', async () => {
@Component({standalone: true, template:`<button (click)="event.emit()">{{value()}}</button>`, selector: 'app-test'})
class AppTestComponent {
readonly value = input.required<string>()
readonly event = output<void>()
}
const value = 'foo bar'
const fn = jest.fn()
const result = await render(
'<app-test [value]="value" (event)="fn($event)"/>',
{
imports: [AppTestComponent],
componentProperties: { value, fn }
}
)
const button = result.getByRole('button')
expect(button).toHaveTextContent(value)
button.click()
expect(fn).toHaveBeenCalled()
}) |
@mumenthalers that's a valid point, and something I was also thinking. |
Using
on
should also work with template renders.https://github.com/testing-library/angular-testing-library/blob/ef521727d9a5a60a998e2ef5f5406400be2a9a0c/apps/example-app/src/app/examples/02-input-output.spec.ts#L35C1-L60C4
@mumenthalers do you have an idea how this can work?
The text was updated successfully, but these errors were encountered: