Reputation: 499
Below is a code sample for the method for which I am struggling to write a spec. How do I call below event from example-spec.js?
$('.send-me').on('click', 'a.cloth-tile.active', function(event) {
// write code here
}
Currently I am writing $(.send-me).click()
but it is not working
Upvotes: 0
Views: 24
Reputation: 337656
The event is bound to a.cloth-tile.active
, so that's where you need to raise the event. You also need to wrap the selector string in quotes:
$('a.cloth-tile.active').click()
Note that this will raise the event on all of those elements in the DOM. If you want to target a specific one use its index.
Upvotes: 1