Make event spy arguments available #113

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@rlevin

rlevin commented Feb 28, 2013

It is useful to be able to check that an event was triggered with specific arguments. This change allows you to do so the same way "argsForCall" allows you to do this with spy function invocations.

@travisjeffery

This comment has been minimized.

Show comment Hide comment
@travisjeffery

travisjeffery Jul 29, 2013

@rlevin I think this API would be better: expect(spyEvent.argsForEvent('body', 'test')[0]).toEqual('arg1');

@rlevin I think this API would be better: expect(spyEvent.argsForEvent('body', 'test')[0]).toEqual('arg1');

@travisjeffery

This comment has been minimized.

Show comment Hide comment
@travisjeffery

travisjeffery Sep 2, 2013

Collaborator

Actually, you can do this already with:

var object = document
, eventName = 'event'
, arg = 'foo'
$(object).trigger(eventName, arg)
expect(eventName).toHaveBeenTriggeredOnAndWith(object, arg)       
Collaborator

travisjeffery commented Sep 2, 2013

Actually, you can do this already with:

var object = document
, eventName = 'event'
, arg = 'foo'
$(object).trigger(eventName, arg)
expect(eventName).toHaveBeenTriggeredOnAndWith(object, arg)       
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment