jasmine-jquery
jasmine-jquery copied to clipboard
EventSpy CANNOT handle custom object
The sencario is coding as follow:
it("when trigger a jQuery custom event", function () {
var obj = {}
var spyEvent = spyOnEvent(obj, 'customEvent')
$(obj).on('customEvent', function (event, data) {
expect(data.msg).toEqual("It's OK")
// It works.
})
$(obj).trigger('customEvent', {msg: "It's OK"})
expect('customEvent').toHaveBeenTriggeredOn(obj)
// Expected event customEvent to have been triggered on [object Object]
expect(spyEvent).toHaveBeenTriggered()
// Expected event customEvent to have been triggered on [object Object]
})
So, could you tell me what the correct method with handling event form custom object?
Could anyone prove this suite?
Yes, I see the same issue, with your suite.