Skip to content

Instantly share code, notes, and snippets.

@mdelillo
Last active June 22, 2016 21:54
Show Gist options
  • Save mdelillo/efc6fab444576f7a26f2 to your computer and use it in GitHub Desktop.
Save mdelillo/efc6fab444576f7a26f2 to your computer and use it in GitHub Desktop.
Testing preventDefault in react
var preventDefaultHandler = jasmine.createSpy('defaultPreventedHandler');
React.addons.TestUtils.Simulate.click(
link,
{ preventDefault: function() { preventDefaultHandler.call(); }}
);
expect(preventDefaultHandler).toHaveBeenCalled();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment