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 elementScenario-2: The
toHaveText
matcher should be applied successfully to find text in an elementScenario-3: The
toHaveClass
matcher should be applied successfully to detect the class of an elementScenario-4: The
toContainHtml
matcher should be applied successfully to find an HTML elementScenario-5: The...