question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request: Add `template` to RenderComponentOptions

See original GitHub issue

https://github.com/testing-library/angular-testing-library/blob/master/projects/testing-library/src/lib/models.ts#L266

TypeScript cannot determine which Type is a component or directive. Because template is from only RenderDirectiveOptions, TypeScript language service cannot suggest it for autocompletion.

In my opinion, render(Comp, { template }) is a common use-case, and it actually works well. I’m using render(Comp, { template } for my specs to use it as a living usage documentation at same time.

it('should accept [someFlag]', async () => {
  await render(FooComponent, {
    template: `<app-foo [someFlag]="true"></app-foo>`
  })
});

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lacolacocommented, Apr 21, 2021

I’d like to create a PR as my first contribution for testing-library! 👍 I’ll work on it in a few days.

0reactions
github-actions[bot]commented, Apr 22, 2021

🎉 This issue has been resolved in version 10.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introduction to components and templates - Angular
An Angular application uses individual components to define and control ... A template is a form of HTML that tells Angular how to...
Read more >
How to pass a custom template to an Angular component?
Solution #2: Passing templates around with ng-template and ng-container ... The above content is not rendered in the DOM by default. We need...
Read more >
7 Ways to Define a Component Template in Vue.js
The quickest and easiest way to define a Vue component template is to add a template property to the component definition and assign...
Read more >
How To Use Templates in a Flask Application - DigitalOcean
In Flask, you can use the Jinja templating language to render HTML templates. A template is a file that can contain both fixed...
Read more >
Angular - Render a template in a sibling component
I would like the #options template to be displayed in the side-panel component which is a sibling of A component. <ng-template #options> <input ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found