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 ...

Get Jasmine Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.