March 2017
Intermediate to advanced
118 pages
2h 1m
English
Testing component classes without rendering their templates works in certain scenarios, but not in all of them. Sometimes we can write a meaningful test only if we render a component's template. We can do that and still keep the test isolated. We just need to render the template without rendering the component's children. This is what is colloquially known as shallow testing. Let's see this approach in action in the following code:
@Component( {moduleId: module.id, templateUrl: 'conversations.html'}) export class ConversationsCmp { folder: Observable<string>; conversations: Observable<Conversation[]>; constructor(route: ActivatedRoute) { this.folder = route.params.pluck<string>('folder'); this.conversations = route.data.pluck<Conversation[]>('conversations'); ...Read now
Unlock full access