O'Reilly logo

Jasmine Cookbook by Munish Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing Jasmine specs using custom jQuery matchers

The jasmine-jquery plugin provides a rich set of custom matchers for jQuery framework. In this recipe, you will learn how to apply various custom matchers in different situations.

To understand this recipe, let's assume that you are developing an application using jQuery/JavaScript and you have to implement test code for various scenarios by applying different custom jQuery matchers.

"As a JavaScript developer I want to apply different custom jQuery matchers so that I can implement a test condition successfully."

Here are the different scenarios:

  • Scenario-1: The toContainText matcher should be applied successfully to find any text in an element
  • Scenario-2: The toHaveText matcher should be applied successfully ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required