Closed AdrienLemaire closed 10 years ago
I was also missing a jQuery call and it figured out to be quite simple.
beforeEach (...)
jQuery.click = jasmine.createSpy("click");
// Verify it has been called
it(...)
...fireEvent(...)
expect(jQuery.click).toHaveBeenCalled()
// My code uses jQuery like this
$("#...").click();
I see.. I'll have to figure out how to do that with mocha&sinon. Thank you!
What is the proper way to extend the rtd JQuery stub with more functions ? I didn't manage to do so in my
stubs.coffee
file, and I don't think that doing a pull request every time I need a new event is the correct solution.Also, the errors reported are not easy to understand. For example:
template
test
it "hides the donation addresses when clicking on #close_donation", -> Template.coinsManager.fireEvent "click #close_donation"
First, my test description is incorrect. All we do here is check that the event is fired, not verifying that slideUp is called. Any idea how to verify that?
And if I make a typo like missing "n" at close_donation:
Result:
Such error makes me believe that fireEvent is undefined. Would be great to see the failing code with the typo in it.