{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/4839","labels_url":"https://api.github.com/repos/facebook/react/issues/4839/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/4839/comments","events_url":"https://api.github.com/repos/facebook/react/issues/4839/events","html_url":"https://github.com/facebook/react/issues/4839","id":105895626,"number":4839,"title":"0.14-rc1: findDOMNode(statelessComponent) doesn’t work with TestUtils.renderIntoDocument","user":{"login":"iamdustan","id":227879,"avatar_url":"https://avatars.githubusercontent.com/u/227879?v=3","gravatar_id":"","url":"https://api.github.com/users/iamdustan","html_url":"https://github.com/iamdustan","followers_url":"https://api.github.com/users/iamdustan/followers","following_url":"https://api.github.com/users/iamdustan/following{/other_user}","gists_url":"https://api.github.com/users/iamdustan/gists{/gist_id}","starred_url":"https://api.github.com/users/iamdustan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamdustan/subscriptions","organizations_url":"https://api.github.com/users/iamdustan/orgs","repos_url":"https://api.github.com/users/iamdustan/repos","events_url":"https://api.github.com/users/iamdustan/events{/privacy}","received_events_url":"https://api.github.com/users/iamdustan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-10T20:54:23Z","updated_at":"2015-12-01T18:12:14Z","closed_at":null,"body":"Unsure if this also impacts in a browser. I wrote an example of this here: https://github.com/iamdustan/react-testing-stateless-components\r\n\r\nI wrote two components. One with `class Component extends React.Component` and the other `var Component = (props) => ()`.\r\n\r\nThe test case is identical for each. The class component test passes. The function component test fails.\r\n\r\n*https://github.com/iamdustan/react-testing-stateless-components/blob/master/class.js*\r\n\r\n``` javascript\r\nimport React from 'react';\r\n\r\nclass Component extends React.Component {\r\n  render() {\r\n    var {onClick, text} = this.props;\r\n    return (\r\n      <button onClick={onClick}>{text}</button>\r\n    );\r\n  }\r\n};\r\n\r\nComponent.propTypes = {\r\n  onClick: React.PropTypes.func.isRequired,\r\n  text: React.PropTypes.string.isRequired,\r\n};\r\n\r\nexport default Component;\r\n```\r\n\r\n*https://github.com/iamdustan/react-testing-stateless-components/blob/master/stateless.js*\r\n\r\n``` javascript\r\nimport React from 'react';\r\n\r\nvar Component = ({onClick, text}) => (\r\n  <button onClick={onClick}>{text}</button>\r\n);\r\n\r\nComponent.propTypes = {\r\n  onClick: React.PropTypes.func.isRequired,\r\n  text: React.PropTypes.string.isRequired,\r\n};\r\n\r\nexport default Component;\r\n```\r\n\r\n*Output*\r\n\r\n```\r\nUsing Jest CLI v5.0.3\r\n FAIL  __tests__/stateless-test.js (0.998s)\r\n● thing › it render\r\n  - TypeError: Cannot read property 'textContent' of null\r\n        at Spec.<anonymous> (/Users/dkasten/projects/react-test-case/__tests__/stateless-test.js:15:34)\r\n        at jasmine.Block.execute (/Users/dkasten/projects/react-test-case/node_modules/jest-cli/vendor/jasmine/jasmine-1.3.0.js:1065:17)\r\n        at jasmine.Queue.next_ (/Users/dkasten/projects/react-test-case/node_modules/jest-cli/vendor/jasmine/jasmine-1.3.0.js:2098:31)\r\n        at null._onTimeout (/Users/dkasten/projects/react-test-case/node_modules/jest-cli/vendor/jasmine/jasmine-1.3.0.js:2088:18)\r\n        at Timer.listOnTimeout (timers.js:89:15)\r\n PASS  __tests__/class-test.js (1.109s)\r\n1 test failed, 1 test passed (2 total)\r\n```\r\n\r\nThis failure is not due to interactions with Jest as it also exists on another project that is not using Jest (although still using jsdom)."},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/161051450","html_url":"https://github.com/facebook/react/issues/4839#issuecomment-161051450","issue_url":"https://api.github.com/repos/facebook/react/issues/4839","id":161051450,"user":{"login":"vinnymac","id":1832781,"avatar_url":"https://avatars.githubusercontent.com/u/1832781?v=3","gravatar_id":"","url":"https://api.github.com/users/vinnymac","html_url":"https://github.com/vinnymac","followers_url":"https://api.github.com/users/vinnymac/followers","following_url":"https://api.github.com/users/vinnymac/following{/other_user}","gists_url":"https://api.github.com/users/vinnymac/gists{/gist_id}","starred_url":"https://api.github.com/users/vinnymac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinnymac/subscriptions","organizations_url":"https://api.github.com/users/vinnymac/orgs","repos_url":"https://api.github.com/users/vinnymac/repos","events_url":"https://api.github.com/users/vinnymac/events{/privacy}","received_events_url":"https://api.github.com/users/vinnymac/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T18:12:14Z","updated_at":"2015-12-01T18:12:14Z","body":"@iamdustan Right now it seems you cannot test event handling with the shallow renderer. At least that is what I gather from #1445. "}}