Book Image

Jasmine Cookbook

By : Munish Kumar
Book Image

Jasmine Cookbook

By: Munish Kumar

Overview of this book

Table of Contents (16 chapters)
Jasmine Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Implementing Jasmine specs with Web/HTML


In Chapter 2, Jasmine with TDD and BDD Processes, we learned how to write incremental code with the BDD approach. In this recipe, we will learn how to develop a web application with HTML and JavaScript using the BDD approach. We will also look at how to write Jasmine specs with HTML and manipulate DOM to test the application from an E2E perspective.

The scope of this recipe is to implement Jasmine specs for both the scenarios described in the previous recipe, Defining Jasmine specs corresponding to user story.

Getting ready

To understand how to implement Jasmine specs with Web/HTML, let's create the TaxCalculator.html file using the following HTML code:

<!DOCTYPE html>
<html>
<head>
  <title>Tax Calculator</title>
  <script type="text/javascript" src="src/validations.js"></script>
</head>
<body class="taxCalculator">
<div id="Wrapper" class="taxWrapper">
  <div id="main" class="taxMain"&gt...