Test-Drive the Component

The component glues together the view and the model that holds data obtained from the service. As a first step, we need to get a few necessary annotation attributes created in the component. The first two tests we have listed lead us exactly there. Let’s start with the first test.

Verify That Component Attributes Are Set

To define the component we will use the ng.core.Component function call and set the annotation property selector in it. If it’s not clear how this will look for our new component, take a quick look at the LangsComponent in the spike.

Writing the component is easy. We have seen an example of that already in the spike. The hard question is, how do we test for it? In other words, we want to write a failing ...

Get Test-Driving JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.