{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react/pulls/comments/83473105","pull_request_review_id":4315907,"id":83473105,"diff_hunk":"@@ -0,0 +1,325 @@\n+---\n+id: test-utils\n+title: Test Utilities\n+permalink: docs/test-utils.html\n+layout: docs\n+category: Reference\n+prev: shallow-compare.html\n+next: perf.html\n+---\n+\n+**Importing**\n+\n+```javascript\n+import ReactTestUtils from 'react-addons-test-utils' // ES6\n+var ReactTestUtils = require('react-addons-test-utils') // ES5 with npm\n+var ReactTestUtils = React.addons.TestUtils; // ES5 with react-with-addons.js\n+```\n+\n+## Overview\n+\n+`ReactTestUtils` makes it easy to test React components in the testing framework of your choice. At Facebook we use [Jest](https://facebook.github.io/jest/) for painless JavaScript testing. Learn how to get started with Jest through the Jest website's [React Tutorial](http://facebook.github.io/jest/docs/tutorial-react.html#content).\n+\n+> Note:\n+>\n+> Airbnb has released a testing utility called Enzyme, which makes it easy to assert, manipulate, and traverse your React Components' output. If you're deciding on a unit testing utility to use together with Jest, or any other test runner, it's worth checking out: [http://airbnb.io/enzyme/](http://airbnb.io/enzyme/)\n+\n+ - [`Simulate`](#simulate)\n+ - [`renderIntoDocument()`](#renderintodocument)\n+ - [`mockComponent()`](#mockcomponent)\n+ - [`isElement()`](#iselement)\n+ - [`isElementOfType()`](#iselementoftype)\n+ - [`isDOMComponent()`](#isdomcomponent)\n+ - [`isCompositeComponent()`](#iscompositecomponent)\n+ - [`isCompositeComponentWithType()`](#iscompositecomponentwithtype)\n+ - [`findAllInRenderedTree()`](#findallinrenderedtree)\n+ - [`scryRenderedDOMComponentsWithClass()`](#scryrendereddomcomponentswithclass)\n+ - [`findRenderedDOMComponentWithClass()`](#findrendereddomcomponentwithclass)\n+ - [`scryRenderedDOMComponentsWithTag()`](#scryrendereddomcomponentswithtag)\n+ - [`findRenderedDOMComponentWithTag()`](#findrendereddomcomponentwithtag)\n+ - [`scryRenderedComponentsWithType()`](#scryrenderedcomponentswithtype)\n+ - [`findRenderedComponentWithType()`](#findrenderedcomponentwithtype)\n+\n+### Shallow Rendering\n+\n+Shallow rendering lets you render a component \"one level deep\" and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM.\n+\n+ - [`createRenderer()`](#createrenderer)\n+ - [`shallowRenderer.render()`](#shallowrenderer.render)\n+ - [`shallowRenderer.getRenderOutput()`](#shallowrenderer.getrenderoutput)\n+\n+Call [`createRenderer()`](#createrenderer) in your tests to create a shallow renderer. You can think of this as a \"place\" to render the component you're testing, where it can respond to events and update itself.","path":"docs/docs/addons-test-utils.md","position":51,"original_position":51,"commit_id":"9996933e48984e18ad0d1eb0c058d66f92c9933d","original_commit_id":"9996933e48984e18ad0d1eb0c058d66f92c9933d","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"body":">You can think of this as a \"place\" to render the component you're testing, where it can respond to events and update itself.\r\n\r\nAFAIK it can't. Shallow rendering doesn't use event system.\r\n\r\nI would just leave\r\n\r\n>You can think of this as a \"place\" to render the component you're testing, and from which you can extract the component's output.","created_at":"2016-10-14T18:07:38Z","updated_at":"2016-10-14T18:07:38Z","html_url":"https://github.com/facebook/react/pull/7961#discussion_r83473105","pull_request_url":"https://api.github.com/repos/facebook/react/pulls/7961","_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/comments/83473105"},"html":{"href":"https://github.com/facebook/react/pull/7961#discussion_r83473105"},"pull_request":{"href":"https://api.github.com/repos/facebook/react/pulls/7961"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/7961","id":89104151,"html_url":"https://github.com/facebook/react/pull/7961","diff_url":"https://github.com/facebook/react/pull/7961.diff","patch_url":"https://github.com/facebook/react/pull/7961.patch","issue_url":"https://api.github.com/repos/facebook/react/issues/7961","number":7961,"state":"open","locked":false,"title":"[New Docs] Update Addon reference docs.","user":{"login":"hramos","id":165856,"avatar_url":"https://avatars.githubusercontent.com/u/165856?v=3","gravatar_id":"","url":"https://api.github.com/users/hramos","html_url":"https://github.com/hramos","followers_url":"https://api.github.com/users/hramos/followers","following_url":"https://api.github.com/users/hramos/following{/other_user}","gists_url":"https://api.github.com/users/hramos/gists{/gist_id}","starred_url":"https://api.github.com/users/hramos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hramos/subscriptions","organizations_url":"https://api.github.com/users/hramos/orgs","repos_url":"https://api.github.com/users/hramos/repos","events_url":"https://api.github.com/users/hramos/events{/privacy}","received_events_url":"https://api.github.com/users/hramos/received_events","type":"User","site_admin":false},"body":"Based on [Add-ons: Test Utilities](https://reactjs-bot.github.io/react/docs-old/test-utils.html)\r\n\r\nThese addon docs read like reference API docs, so they will be listed under \"Addons\" in the \"Reference\" section of the sidebar.\r\n\r\nLets update addons.md as more of these addon docs are moved out of docs-old.\r\n\r\n![screencapture-localhost-4000-react-docs-test-utils-html-1476310283663](https://cloud.githubusercontent.com/assets/165856/19329609/81458188-908e-11e6-9cf6-1c29f6430e8b.png)\r\n","created_at":"2016-10-12T22:15:42Z","updated_at":"2016-10-14T18:36:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7c4778ef5202eef02f554b3660e4d2f7d1634e6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react/pulls/7961/commits","review_comments_url":"https://api.github.com/repos/facebook/react/pulls/7961/comments","review_comment_url":"https://api.github.com/repos/facebook/react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react/issues/7961/comments","statuses_url":"https://api.github.com/repos/facebook/react/statuses/9996933e48984e18ad0d1eb0c058d66f92c9933d","head":{"label":"hramos:test-utils","ref":"test-utils","sha":"9996933e48984e18ad0d1eb0c058d66f92c9933d","user":{"login":"hramos","id":165856,"avatar_url":"https://avatars.githubusercontent.com/u/165856?v=3","gravatar_id":"","url":"https://api.github.com/users/hramos","html_url":"https://github.com/hramos","followers_url":"https://api.github.com/users/hramos/followers","following_url":"https://api.github.com/users/hramos/following{/other_user}","gists_url":"https://api.github.com/users/hramos/gists{/gist_id}","starred_url":"https://api.github.com/users/hramos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hramos/subscriptions","organizations_url":"https://api.github.com/users/hramos/orgs","repos_url":"https://api.github.com/users/hramos/repos","events_url":"https://api.github.com/users/hramos/events{/privacy}","received_events_url":"https://api.github.com/users/hramos/received_events","type":"User","site_admin":false},"repo":{"id":70006618,"name":"react","full_name":"hramos/react","owner":{"login":"hramos","id":165856,"avatar_url":"https://avatars.githubusercontent.com/u/165856?v=3","gravatar_id":"","url":"https://api.github.com/users/hramos","html_url":"https://github.com/hramos","followers_url":"https://api.github.com/users/hramos/followers","following_url":"https://api.github.com/users/hramos/following{/other_user}","gists_url":"https://api.github.com/users/hramos/gists{/gist_id}","starred_url":"https://api.github.com/users/hramos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hramos/subscriptions","organizations_url":"https://api.github.com/users/hramos/orgs","repos_url":"https://api.github.com/users/hramos/repos","events_url":"https://api.github.com/users/hramos/events{/privacy}","received_events_url":"https://api.github.com/users/hramos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hramos/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":true,"url":"https://api.github.com/repos/hramos/react","forks_url":"https://api.github.com/repos/hramos/react/forks","keys_url":"https://api.github.com/repos/hramos/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hramos/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hramos/react/teams","hooks_url":"https://api.github.com/repos/hramos/react/hooks","issue_events_url":"https://api.github.com/repos/hramos/react/issues/events{/number}","events_url":"https://api.github.com/repos/hramos/react/events","assignees_url":"https://api.github.com/repos/hramos/react/assignees{/user}","branches_url":"https://api.github.com/repos/hramos/react/branches{/branch}","tags_url":"https://api.github.com/repos/hramos/react/tags","blobs_url":"https://api.github.com/repos/hramos/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hramos/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hramos/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/hramos/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hramos/react/statuses/{sha}","languages_url":"https://api.github.com/repos/hramos/react/languages","stargazers_url":"https://api.github.com/repos/hramos/react/stargazers","contributors_url":"https://api.github.com/repos/hramos/react/contributors","subscribers_url":"https://api.github.com/repos/hramos/react/subscribers","subscription_url":"https://api.github.com/repos/hramos/react/subscription","commits_url":"https://api.github.com/repos/hramos/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/hramos/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/hramos/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/hramos/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/hramos/react/contents/{+path}","compare_url":"https://api.github.com/repos/hramos/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hramos/react/merges","archive_url":"https://api.github.com/repos/hramos/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hramos/react/downloads","issues_url":"https://api.github.com/repos/hramos/react/issues{/number}","pulls_url":"https://api.github.com/repos/hramos/react/pulls{/number}","milestones_url":"https://api.github.com/repos/hramos/react/milestones{/number}","notifications_url":"https://api.github.com/repos/hramos/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hramos/react/labels{/name}","releases_url":"https://api.github.com/repos/hramos/react/releases{/id}","deployments_url":"https://api.github.com/repos/hramos/react/deployments","created_at":"2016-10-04T21:10:18Z","updated_at":"2016-10-04T21:10:23Z","pushed_at":"2016-10-14T17:00:29Z","git_url":"git://github.com/hramos/react.git","ssh_url":"git@github.com:hramos/react.git","clone_url":"https://github.com/hramos/react.git","svn_url":"https://github.com/hramos/react","homepage":"https://facebook.github.io/react/","size":104004,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"facebook:new-docs","ref":"new-docs","sha":"a583a8f2b40c2cae3875c93829141dd6bc5d327e","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":10270250,"name":"react","full_name":"facebook/react","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":false,"url":"https://api.github.com/repos/facebook/react","forks_url":"https://api.github.com/repos/facebook/react/forks","keys_url":"https://api.github.com/repos/facebook/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react/teams","hooks_url":"https://api.github.com/repos/facebook/react/hooks","issue_events_url":"https://api.github.com/repos/facebook/react/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react/events","assignees_url":"https://api.github.com/repos/facebook/react/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react/tags","blobs_url":"https://api.github.com/repos/facebook/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react/languages","stargazers_url":"https://api.github.com/repos/facebook/react/stargazers","contributors_url":"https://api.github.com/repos/facebook/react/contributors","subscribers_url":"https://api.github.com/repos/facebook/react/subscribers","subscription_url":"https://api.github.com/repos/facebook/react/subscription","commits_url":"https://api.github.com/repos/facebook/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react/merges","archive_url":"https://api.github.com/repos/facebook/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react/downloads","issues_url":"https://api.github.com/repos/facebook/react/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react/deployments","created_at":"2013-05-24T16:15:54Z","updated_at":"2016-10-14T17:16:30Z","pushed_at":"2016-10-14T17:51:31Z","git_url":"git://github.com/facebook/react.git","ssh_url":"git@github.com:facebook/react.git","clone_url":"https://github.com/facebook/react.git","svn_url":"https://github.com/facebook/react","homepage":"https://facebook.github.io/react/","size":140538,"stargazers_count":51703,"watchers_count":51703,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9037,"mirror_url":null,"open_issues_count":706,"forks":9037,"open_issues":706,"watchers":51703,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/7961"},"html":{"href":"https://github.com/facebook/react/pull/7961"},"issue":{"href":"https://api.github.com/repos/facebook/react/issues/7961"},"comments":{"href":"https://api.github.com/repos/facebook/react/issues/7961/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react/pulls/7961/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react/pulls/7961/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react/statuses/9996933e48984e18ad0d1eb0c058d66f92c9933d"}}}}
{"actor":{"display_login":"gaearon"}}