{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/1632","repository_url":"https://api.github.com/repos/airbnb/enzyme","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/1632/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/1632/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/1632/events","html_url":"https://github.com/airbnb/enzyme/issues/1632","id":318619024,"node_id":"MDU6SXNzdWUzMTg2MTkwMjQ=","number":1632,"title":"Simulated click does not update component props","user":{"login":"pivcec","id":30620101,"node_id":"MDQ6VXNlcjMwNjIwMTAx","avatar_url":"https://avatars1.githubusercontent.com/u/30620101?v=4","gravatar_id":"","url":"https://api.github.com/users/pivcec","html_url":"https://github.com/pivcec","followers_url":"https://api.github.com/users/pivcec/followers","following_url":"https://api.github.com/users/pivcec/following{/other_user}","gists_url":"https://api.github.com/users/pivcec/gists{/gist_id}","starred_url":"https://api.github.com/users/pivcec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pivcec/subscriptions","organizations_url":"https://api.github.com/users/pivcec/orgs","repos_url":"https://api.github.com/users/pivcec/repos","events_url":"https://api.github.com/users/pivcec/events{/privacy}","received_events_url":"https://api.github.com/users/pivcec/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-28T09:31:42Z","updated_at":"2018-07-08T00:00:41Z","closed_at":"2018-07-07T18:37:41Z","author_association":"NONE","body":"### Current behavior\r\nWhen I simulate a click on avatarImage then pieWrapper length = 0.\r\n\r\n```\r\n  it('Renders PieWrapper when AvatarImage is clicked', () => {\r\n    const updateHoveredAvatarId = jest.fn();\r\n    const updateSelectedAvatarId = jest.fn();\r\n    const avatar = shallow(<Avatar\r\n      activeAvatarId={null}\r\n      hoveredAvatarId={1}\r\n      id={1}\r\n      selectedAvatarId={2}\r\n      updateHoveredAvatarId={() => updateHoveredAvatarId()}\r\n      updateSelectedAvatarId={() => updateSelectedAvatarId()}\r\n    />);\r\n    const avatarImage = avatar.find(AvatarImage);\r\n    avatarImage.simulate('click');\r\n    // avatar.instance().forceUpdate();\r\n    // avatar.update();\r\n    const pieWrapper = avatar.find(PieWrapper);\r\n    console.log(avatarImage);    \r\n    console.log(pieWrapper);\r\n    // const pieWrapper = avatar.find(PieWrapper);\r\n    // expect(pieWrapper.instance()).toBeInstanceOf(PieWrapper);\r\n  });\r\n```\r\n\r\n### Expected behavior\r\nSimulating a click on avatarImage should update activeAvatarId state in parent component to 1 (via callback function) - which should cause avatar to re-render and return pieWrapper.\r\n\r\nClicking on the actual component in the browser does exactly that.\r\n\r\nThis is a CRA app.\r\n\r\n- [ ] shallow\r\n- [x] mount\r\n- [ ] render\r\n\r\n#### Version\r\n\r\n| library         | version\r\n| ---------------- | -------\r\n| Enzyme           | 3.3.0\r\n| React            |  16.3.2\r\n\r\n#### Adapter\r\n\r\n- [x] enzyme-adapter-react-16\r\n- [ ] enzyme-adapter-react-15\r\n- [ ] enzyme-adapter-react-15.4\r\n- [ ] enzyme-adapter-react-14\r\n- [ ] enzyme-adapter-react-13\r\n- [ ] enzyme-adapter-react-helper\r\n- [ ] others ( ) \r\n"},"comment":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/comments/403250862","html_url":"https://github.com/airbnb/enzyme/issues/1632#issuecomment-403250862","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/1632","id":403250862,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzI1MDg2Mg==","user":{"login":"ljharb","id":45469,"node_id":"MDQ6VXNlcjQ1NDY5","avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2018-07-08T00:00:41Z","updated_at":"2018-07-08T00:00:41Z","author_association":"MEMBER","body":"@craigkovatch the method exists because react-test-renderer's shallow renderer had a \"simulate\" option, at the time enzyme was first created.\r\n\r\nIt still exists because it wasn't until v2 that it became abundantly clear that it's a terrible method, and it wasn't removed in v3 because we wanted to make the migration to v3 as easy as possible. However, whenever a v4 comes around, it will be removed for certain."}}
{"actor":{"display_login":"ljharb"}}