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

Designing Jasmine specs with HTML and JSON fixtures


In this recipe, you will learn how to write Jasmine specs for JSON and HTML fixtures with the help of the jasmine-jquery plugin. It provides two extensions for the Jasmine JavaScript Testing Framework:

  • An API for handling HTML and JSON fixtures in your specs

  • A set of custom matchers for jQuery framework

The scope of this recipe is to design specs using HTML and JSON fixtures. For information on custom jQuery matchers, refer to the Writing Jasmine specs using custom jQuery matchers recipe.

To understand this recipe, let's assume that you are developing a JavaScript application and you have to develop test code for various scenarios using HTML and JSON fixtures.

"As a JavaScript developer, I want to apply/use HTML/JSON fixtures so that I can implement a test condition successfully."

Let's consider the following scenario in current context:

  • Scenario-1: Jasmine specs should be designed using HTML and JSON fixtures

Getting ready

In order to write Jasmine...