describe('#clicker', function(){
it('triggers the event handler', function(){
var handler = jasmine.createSpy('handles clicks');
var event = $.Event('click');
$.jasmine.inject('
');
clicker('.my-button',handler);
$('.my-button').trigger(event);
expect(handler).toHaveBeenCalledWith(event);
});
it('prevents default browser behavior', function(){
var handler = jasmine.createSpy('handles clicks');
var event = $.Event('click');
spyOn(event,'preventDefault');
$.jasmine.inject('
');
clicker('.my-button',handler);
$('.my-button').trigger(event);
expect(event.preventDefault).toHaveBeenCalled();
});
});