jasmine-jquery icon indicating copy to clipboard operation
jasmine-jquery copied to clipboard

EventSpy CANNOT handle custom object

Open leiming opened this issue 9 years ago • 2 comments

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?

leiming avatar Jul 29 '15 08:07 leiming

Could anyone prove this suite?

leiming avatar Aug 03 '15 03:08 leiming

Yes, I see the same issue, with your suite.

mitcoding avatar Sep 13 '16 01:09 mitcoding