karma fails for Tour of Heroes tutorial, part 3, Multiple Components
See original GitHub issueContinued from: https://github.com/angular/quickstart/pull/184
I cannot run npm test on the results of the Tour of Heroes tutorial, part 3, Multiple Components. It produces this error:
Chrome 52.0.2743 (Mac OS X 10.11.6) AppComponent with TCB should instantiate component FAILED
[1] Error: Template parse errors:
[1] Can't bind to 'hero' since it isn't a known property of 'my-hero-detail'.
[1] 1. If 'my-hero-detail' is an Angular component and it has 'hero' input, then verify that it is part of this module.
[1] 2. If 'my-hero-detail' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
[1] ("
[1] </li>
[1] </ul>
[1] <my-hero-detail [ERROR ->][hero]="selectedHero"></my-hero-detail>
[1] "): AppComponent@10:20
It seems to me that hero is a known property of my-hero-detail:
export class HeroDetailComponent {
@Input()
hero: Hero;
}
What am I missing?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Unit Testing Tour of Heroes: Hero Service | by Luke Lindner
This tutorial will take you through creating these tests for this application. You should be familiar with the basics of Karma and Jasmine,...
Read more >Using Components - Angular Tour of Heroes Tutorial Part 2
Creating a Component in Angular - Using Components - Angular Tour of Heroes Tutorial Part 2. 2.9K views · 1 year ago ......
Read more >Angular tour-of-heroes: no provider for HttpClient when testing ...
I'm new to Angular tests and this is quite annoying when you just try to run the ng test from the official tutorial...
Read more >Testing Angular routing components with the ...
Angular testing with the RouterTestingModule (3 Part Series) ... for the DashboardComponent from the Tour of Heroes tutorial on Angular.io.
Read more >Tour of Heroes application and tutorial - Angular
Try it now covers the same major topics —components, template syntax, routing, services, and accessing data using HTTP— in a condensed format, following...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a solution!
Figuring perhaps the spec test needs to know about HeroDetailComponent, I modified app/app.component.spec.ts, by adding:
and changing beforeEach() to include HeroDetailComponent in its declarations:
Please update the tutorial to include these changes.
The right solution is to configure your testing module correctly:
Tour of Heroes doesn’t talk about unit tests so it really doesn’t make sense to update it with these solutions. Instead, we have the testing chapter at https://angular.io/docs/ts/latest/guide/testing.html