Book Image

Jasmine JavaScript Testing Update

By : Paulo Vitor Zacharias Ragonha
Book Image

Jasmine JavaScript Testing Update

By: Paulo Vitor Zacharias Ragonha

Overview of this book

Table of Contents (15 chapters)

Using HTML fixtures


Continuing with the development of the NewInvestmentView component, we can write some basic acceptance criteria, such as the following:

  • NewInvestmentView should allow the input of the stock symbol

  • NewInvestmentView should allow the input of shares

  • NewInvestmentView should allow the input of the share price

There are many more, but this is a good start.

Create a new spec file for this component in the new file NewInvestmentViewSpec.js inside the spec folder, and we can start to translate those specs, as follows:

describe("NewInvestmentView", function() {
  it("should allow the input of the stock symbol", function() {
  });

  it("should allow the input of shares", function() {
  });

  it("should allow the input of the share price", function() {
  });
});

However, before we can start to implement these, we must first understand the concept of HTML fixtures.

Test fixtures provide the base state in which the tests run. It could be a class instantiation, the definition of an object...