Book Image

Mastering Angular Components - Second Edition

By : Gion Kunz
Book Image

Mastering Angular Components - Second Edition

By: Gion Kunz

Overview of this book

Mastering Angular Components will help you learn how to invent, build, and manage shared and reusable components for your web projects. Angular components are an integral part of any Angular app and are responsible for performing specific tasks in controlling the user interface. Complete with detailed explanations of essential concepts and practical examples, the book begins by helping you build basic layout components, along with developing a fully functional task-management application using Angular. You’ll then learn how to create layout components and build clean data and state architecture for your application. The book will even help you understand component-based routing and create components that render Scalable Vector Graphics (SVG). Toward the concluding chapters, you’ll be able to visualize data using the third-party library Chartist and create a plugin architecture using Angular components. By the end of this book, you will have mastered the component-based architecture in Angular and have the skills you need to build modern and clean user interfaces.
Table of Contents (12 chapters)

Summary

In this last chapter of the book, we learned how to write concise unit tests for our components. We followed a BDD style approach of writing tests, and we also covered the basics of the JavaScript testing framework, Jasmine.

We learned about the debugging tools that are available in Angular, and how to set up an environment for testing. Using the Angular Testbed utility class, we were able to perform tests in a very flexible but precise way. We also learned about the debug view tree and the component fixture. These allowed us to perform clever inspections and apply practical queries to the rendered views, in order to assert expected results.

We used the inject and async helpers to inject dependencies, and to run asynchronous tests at the same time. We built mock components, in order to isolate our tests from the rest of our application.

...