{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/62434525","id":62434525,"diff_hunk":"@@ -860,6 +860,47 @@ describe('shallow', () => {\n \n     });\n \n+    it('should propagate events', () => {\n+      const innerOnClick = sinon.spy();\n+      const outerOnClick = sinon.spy();\n+      class Foo extends React.Component {\n+        render() {\n+          return (\n+            <div onClick={outerOnClick}>\n+              <a onClick={innerOnClick}>foo</a>\n+            </div>\n+          );\n+        }\n+      }\n+\n+      const wrapper = shallow(<Foo />);\n+\n+      wrapper.find('a').simulate('click');\n+      expect(innerOnClick.calledOnce).to.equal(true);\n+      expect(outerOnClick.calledOnce).to.equal(true);\n+    });\n+\n+    it('should respect event.stopPropagation()', () => {\n+      const innerOnClick = sinon.spy(e => {\n+        e.stopPropagation();\n+      });\n+      const outerOnClick = sinon.spy();\n+      class Foo extends React.Component {\n+        render() {\n+          return (\n+            <div onClick={outerOnClick}>\n+              <a onClick={innerOnClick}>foo</a>","path":"test/ShallowWrapper-spec.js","position":11,"original_position":33,"commit_id":"aec6a41eace8df06b10cd443108f7335eefcc0a1","original_commit_id":"aec6a41eace8df06b10cd443108f7335eefcc0a1","user":{"login":"lelandrichardson","id":1885623,"avatar_url":"https://avatars.githubusercontent.com/u/1885623?v=3","gravatar_id":"","url":"https://api.github.com/users/lelandrichardson","html_url":"https://github.com/lelandrichardson","followers_url":"https://api.github.com/users/lelandrichardson/followers","following_url":"https://api.github.com/users/lelandrichardson/following{/other_user}","gists_url":"https://api.github.com/users/lelandrichardson/gists{/gist_id}","starred_url":"https://api.github.com/users/lelandrichardson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lelandrichardson/subscriptions","organizations_url":"https://api.github.com/users/lelandrichardson/orgs","repos_url":"https://api.github.com/users/lelandrichardson/repos","events_url":"https://api.github.com/users/lelandrichardson/events{/privacy}","received_events_url":"https://api.github.com/users/lelandrichardson/received_events","type":"User","site_admin":false},"body":"some good additional test cases for propogation might be:\r\n\r\n1. ensure that it can skip over parent nodes that don't have `onClick` defined, etc.\r\n2. ensure that it propogates beyond n=2 (ie, parent + grandparent).","created_at":"2016-05-08T16:33:33Z","updated_at":"2016-05-08T16:33:33Z","html_url":"https://github.com/airbnb/enzyme/pull/368#discussion_r62434525","pull_request_url":"https://api.github.com/repos/airbnb/enzyme/pulls/368","_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/62434525"},"html":{"href":"https://github.com/airbnb/enzyme/pull/368#discussion_r62434525"},"pull_request":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/368"}}},"pull_request":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/368","id":69216378,"html_url":"https://github.com/airbnb/enzyme/pull/368","diff_url":"https://github.com/airbnb/enzyme/pull/368.diff","patch_url":"https://github.com/airbnb/enzyme/pull/368.patch","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/368","number":368,"state":"open","locked":false,"title":"[RFC] shallow wrapper .simulate() SyntheticEvent and event propagation","user":{"login":"nfcampos","id":56902,"avatar_url":"https://avatars.githubusercontent.com/u/56902?v=3","gravatar_id":"","url":"https://api.github.com/users/nfcampos","html_url":"https://github.com/nfcampos","followers_url":"https://api.github.com/users/nfcampos/followers","following_url":"https://api.github.com/users/nfcampos/following{/other_user}","gists_url":"https://api.github.com/users/nfcampos/gists{/gist_id}","starred_url":"https://api.github.com/users/nfcampos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfcampos/subscriptions","organizations_url":"https://api.github.com/users/nfcampos/orgs","repos_url":"https://api.github.com/users/nfcampos/repos","events_url":"https://api.github.com/users/nfcampos/events{/privacy}","received_events_url":"https://api.github.com/users/nfcampos/received_events","type":"User","site_admin":false},"body":"What do you guys think about this? I just added an empty React SyntheticEvent as the first argument that `.simulate` calls event handlers with.\r\nThis provides the regular event methods (`stopPropagation` and friends) by default but still allows the user to replace them eg. with spies, exactly the same way they do now.\r\n\r\n## todo\r\n- [ ] make propagation tests tree be deeper\r\n  - [ ] assert that event handlers for other events aren't called neither on target node nor on parents\r\n- [ ] test propagation when clicking on a 'composite' node\r\n- [ ] assert presence of `stopPropagation` and friends on event object passed to event handlers\r\n- [ ] guard with `this.single`\r\n  - [ ] test that it throws with more than one node\r\n  - [ ] test that it works with forEach on multiple nodes\r\n- [ ] add propagation tests for SFCs\r\n- [ ] add propagation tests for createClass?","created_at":"2016-05-06T21:59:38Z","updated_at":"2016-05-08T16:33:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be1157f2a144052a6d36e48e6cd9105f626bf59a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/enzyme/pulls/368/commits","review_comments_url":"https://api.github.com/repos/airbnb/enzyme/pulls/368/comments","review_comment_url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/368/comments","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/aec6a41eace8df06b10cd443108f7335eefcc0a1","head":{"label":"nfcampos:events","ref":"events","sha":"aec6a41eace8df06b10cd443108f7335eefcc0a1","user":{"login":"nfcampos","id":56902,"avatar_url":"https://avatars.githubusercontent.com/u/56902?v=3","gravatar_id":"","url":"https://api.github.com/users/nfcampos","html_url":"https://github.com/nfcampos","followers_url":"https://api.github.com/users/nfcampos/followers","following_url":"https://api.github.com/users/nfcampos/following{/other_user}","gists_url":"https://api.github.com/users/nfcampos/gists{/gist_id}","starred_url":"https://api.github.com/users/nfcampos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfcampos/subscriptions","organizations_url":"https://api.github.com/users/nfcampos/orgs","repos_url":"https://api.github.com/users/nfcampos/repos","events_url":"https://api.github.com/users/nfcampos/events{/privacy}","received_events_url":"https://api.github.com/users/nfcampos/received_events","type":"User","site_admin":false},"repo":{"id":58234500,"name":"enzyme","full_name":"nfcampos/enzyme","owner":{"login":"nfcampos","id":56902,"avatar_url":"https://avatars.githubusercontent.com/u/56902?v=3","gravatar_id":"","url":"https://api.github.com/users/nfcampos","html_url":"https://github.com/nfcampos","followers_url":"https://api.github.com/users/nfcampos/followers","following_url":"https://api.github.com/users/nfcampos/following{/other_user}","gists_url":"https://api.github.com/users/nfcampos/gists{/gist_id}","starred_url":"https://api.github.com/users/nfcampos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfcampos/subscriptions","organizations_url":"https://api.github.com/users/nfcampos/orgs","repos_url":"https://api.github.com/users/nfcampos/repos","events_url":"https://api.github.com/users/nfcampos/events{/privacy}","received_events_url":"https://api.github.com/users/nfcampos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nfcampos/enzyme","description":"JavaScript Testing utilities for React","fork":true,"url":"https://api.github.com/repos/nfcampos/enzyme","forks_url":"https://api.github.com/repos/nfcampos/enzyme/forks","keys_url":"https://api.github.com/repos/nfcampos/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nfcampos/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nfcampos/enzyme/teams","hooks_url":"https://api.github.com/repos/nfcampos/enzyme/hooks","issue_events_url":"https://api.github.com/repos/nfcampos/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/nfcampos/enzyme/events","assignees_url":"https://api.github.com/repos/nfcampos/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/nfcampos/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/nfcampos/enzyme/tags","blobs_url":"https://api.github.com/repos/nfcampos/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nfcampos/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nfcampos/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/nfcampos/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nfcampos/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/nfcampos/enzyme/languages","stargazers_url":"https://api.github.com/repos/nfcampos/enzyme/stargazers","contributors_url":"https://api.github.com/repos/nfcampos/enzyme/contributors","subscribers_url":"https://api.github.com/repos/nfcampos/enzyme/subscribers","subscription_url":"https://api.github.com/repos/nfcampos/enzyme/subscription","commits_url":"https://api.github.com/repos/nfcampos/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/nfcampos/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/nfcampos/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/nfcampos/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/nfcampos/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/nfcampos/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nfcampos/enzyme/merges","archive_url":"https://api.github.com/repos/nfcampos/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nfcampos/enzyme/downloads","issues_url":"https://api.github.com/repos/nfcampos/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/nfcampos/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/nfcampos/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/nfcampos/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nfcampos/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/nfcampos/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/nfcampos/enzyme/deployments","created_at":"2016-05-06T20:57:36Z","updated_at":"2016-05-06T20:57:36Z","pushed_at":"2016-05-08T10:24:48Z","git_url":"git://github.com/nfcampos/enzyme.git","ssh_url":"git@github.com:nfcampos/enzyme.git","clone_url":"https://github.com/nfcampos/enzyme.git","svn_url":"https://github.com/nfcampos/enzyme","homepage":"http://airbnb.io/enzyme/","size":1237,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"b106257be7095e7b92050178b4558a9ec6b51021","user":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":45942274,"name":"enzyme","full_name":"airbnb/enzyme","owner":{"login":"airbnb","id":698437,"avatar_url":"https://avatars.githubusercontent.com/u/698437?v=3","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/enzyme","description":"JavaScript Testing utilities for React","fork":false,"url":"https://api.github.com/repos/airbnb/enzyme","forks_url":"https://api.github.com/repos/airbnb/enzyme/forks","keys_url":"https://api.github.com/repos/airbnb/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/enzyme/teams","hooks_url":"https://api.github.com/repos/airbnb/enzyme/hooks","issue_events_url":"https://api.github.com/repos/airbnb/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/enzyme/events","assignees_url":"https://api.github.com/repos/airbnb/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/enzyme/tags","blobs_url":"https://api.github.com/repos/airbnb/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/enzyme/languages","stargazers_url":"https://api.github.com/repos/airbnb/enzyme/stargazers","contributors_url":"https://api.github.com/repos/airbnb/enzyme/contributors","subscribers_url":"https://api.github.com/repos/airbnb/enzyme/subscribers","subscription_url":"https://api.github.com/repos/airbnb/enzyme/subscription","commits_url":"https://api.github.com/repos/airbnb/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/enzyme/merges","archive_url":"https://api.github.com/repos/airbnb/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/enzyme/downloads","issues_url":"https://api.github.com/repos/airbnb/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/enzyme/deployments","created_at":"2015-11-10T21:45:38Z","updated_at":"2016-05-08T14:11:10Z","pushed_at":"2016-05-08T10:24:49Z","git_url":"git://github.com/airbnb/enzyme.git","ssh_url":"git@github.com:airbnb/enzyme.git","clone_url":"https://github.com/airbnb/enzyme.git","svn_url":"https://github.com/airbnb/enzyme","homepage":"http://airbnb.io/enzyme/","size":1652,"stargazers_count":4761,"watchers_count":4761,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":229,"mirror_url":null,"open_issues_count":69,"forks":229,"open_issues":69,"watchers":4761,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/368"},"html":{"href":"https://github.com/airbnb/enzyme/pull/368"},"issue":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/368"},"comments":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/368/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/368/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/368/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/enzyme/statuses/aec6a41eace8df06b10cd443108f7335eefcc0a1"}}}}