{"action":"created","comment":{"url":"https://api.github.com/repos/rackt/react-router/pulls/comments/46762715","id":46762715,"diff_hunk":"@@ -0,0 +1,101 @@\n+import expect from 'expect'\n+import React from 'react'\n+import { render, unmountComponentAtNode } from 'react-dom'\n+import RoutingContext from '../RoutingContext'\n+import match from '../match'\n+\n+describe('For Real RoutingContext', () => {\n+  let node, routes, context, history\n+\n+  beforeEach(() => {\n+    node = document.createElement('div')\n+    history = { push() {}, replace() {} }\n+\n+    class Component extends React.Component {\n+      constructor(props, ctx) {\n+        super(props, ctx)\n+        context = ctx\n+      }\n+      render() { return null }\n+    }\n+\n+    Component.contextTypes = {\n+      router: React.PropTypes.object.isRequired\n+    }\n+\n+    routes = { path: '/', component: Component }\n+  })\n+\n+  afterEach(() => unmountComponentAtNode(node))\n+\n+  function renderTest(done) {\n+    match({ location: '/', routes }, (err, redirect, renderProps) => {\n+      render(<RoutingContext {...renderProps} history={history} />, node)\n+      done()\n+    })\n+  }\n+\n+  describe('2.0', () => {\n+    it('exports only `router` to context')\n+  })\n+\n+  it('exports a `router` object to routing context', (done) => {\n+    renderTest(() => {\n+      expect(context.router).toExist()\n+      done()\n+    })\n+  })\n+\n+  describe('interaction with history', () => {\n+    it('proxies calls to `push` to `props.history`', (done) => {\n+      const args = [ 1, 2, 3 ]\n+      history.push = (...params) => {\n+        expect(params).toEqual(args)\n+        done()\n+      }\n+      renderTest(() => {\n+        context.router.push(...args)\n+      })\n+    })\n+\n+    it('proxies calls to `replace` to `props.history`', (done) => {\n+      const args = [ 1, 2, 3 ]\n+      history.replace = (...params) => {\n+        expect(params).toEqual(args)\n+        done()\n+      }\n+      renderTest(() => {\n+        context.router.replace(...args)\n+      })\n+    })\n+\n+    it('proxies calls to `addRouteLeaveHook` to `props.history`', (done) => {\n+      const args = [ 1, 2, 3 ]\n+      const retVal = function () {}\n+      history.listenBeforeLeavingRoute = (...params) => {\n+        expect(params).toEqual(args)\n+        return retVal\n+      }\n+      renderTest(() => {\n+        const remove = context.router.addRouteLeaveHook(...args)\n+        expect(remove).toBe(retVal)\n+        done()\n+      })\n+    })\n+","path":"modules/__tests__/RoutingContext-test.js","position":85,"original_position":85,"commit_id":"8df21386094ff768700e884430baac471c36ecd5","original_commit_id":"8df21386094ff768700e884430baac471c36ecd5","user":{"login":"ryanflorence","id":100200,"avatar_url":"https://avatars.githubusercontent.com/u/100200?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanflorence","html_url":"https://github.com/ryanflorence","followers_url":"https://api.github.com/users/ryanflorence/followers","following_url":"https://api.github.com/users/ryanflorence/following{/other_user}","gists_url":"https://api.github.com/users/ryanflorence/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanflorence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanflorence/subscriptions","organizations_url":"https://api.github.com/users/ryanflorence/orgs","repos_url":"https://api.github.com/users/ryanflorence/repos","events_url":"https://api.github.com/users/ryanflorence/events{/privacy}","received_events_url":"https://api.github.com/users/ryanflorence/received_events","type":"User","site_admin":false},"body":"`isActive` will likely change when `useRoutes` is refactored into `match`, but this is a functioning iteration, so we don't need to tackle it all at once.","created_at":"2015-12-05T20:35:44Z","updated_at":"2015-12-05T20:35:44Z","html_url":"https://github.com/rackt/react-router/pull/2647#discussion_r46762715","pull_request_url":"https://api.github.com/repos/rackt/react-router/pulls/2647","_links":{"self":{"href":"https://api.github.com/repos/rackt/react-router/pulls/comments/46762715"},"html":{"href":"https://github.com/rackt/react-router/pull/2647#discussion_r46762715"},"pull_request":{"href":"https://api.github.com/repos/rackt/react-router/pulls/2647"}}},"pull_request":{"url":"https://api.github.com/repos/rackt/react-router/pulls/2647","id":52763586,"html_url":"https://github.com/rackt/react-router/pull/2647","diff_url":"https://github.com/rackt/react-router/pull/2647.diff","patch_url":"https://github.com/rackt/react-router/pull/2647.patch","issue_url":"https://api.github.com/repos/rackt/react-router/issues/2647","number":2647,"state":"open","locked":false,"title":"1.1 context.router","user":{"login":"ryanflorence","id":100200,"avatar_url":"https://avatars.githubusercontent.com/u/100200?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanflorence","html_url":"https://github.com/ryanflorence","followers_url":"https://api.github.com/users/ryanflorence/followers","following_url":"https://api.github.com/users/ryanflorence/following{/other_user}","gists_url":"https://api.github.com/users/ryanflorence/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanflorence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanflorence/subscriptions","organizations_url":"https://api.github.com/users/ryanflorence/orgs","repos_url":"https://api.github.com/users/ryanflorence/repos","events_url":"https://api.github.com/users/ryanflorence/events{/privacy}","received_events_url":"https://api.github.com/users/ryanflorence/received_events","type":"User","site_admin":false},"body":"Peep the commit message.\r\n\r\n- I could use some help updating all the stuff in `/docs`. Don't worry about CHANGES.md. The changes coming down the pipe after this will require a more cohesive explanation of how to update your code than we can do with each individual commit that changes API.\r\n- could use help updating all of OUR code to the new API (particularly in `Link` and in our tests), but that should maybe be a separate pull request just to \"prove\" that the old API still works (afaict it does, tests pass anyway!).","created_at":"2015-12-05T20:20:08Z","updated_at":"2015-12-05T20:35:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0e32b4a7126cdb2f24a834d805d388f7bbe7609","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackt/react-router/pulls/2647/commits","review_comments_url":"https://api.github.com/repos/rackt/react-router/pulls/2647/comments","review_comment_url":"https://api.github.com/repos/rackt/react-router/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackt/react-router/issues/2647/comments","statuses_url":"https://api.github.com/repos/rackt/react-router/statuses/8df21386094ff768700e884430baac471c36ecd5","head":{"label":"rackt:1.1-context.router","ref":"1.1-context.router","sha":"8df21386094ff768700e884430baac471c36ecd5","user":{"login":"rackt","id":8261421,"avatar_url":"https://avatars.githubusercontent.com/u/8261421?v=3","gravatar_id":"","url":"https://api.github.com/users/rackt","html_url":"https://github.com/rackt","followers_url":"https://api.github.com/users/rackt/followers","following_url":"https://api.github.com/users/rackt/following{/other_user}","gists_url":"https://api.github.com/users/rackt/gists{/gist_id}","starred_url":"https://api.github.com/users/rackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackt/subscriptions","organizations_url":"https://api.github.com/users/rackt/orgs","repos_url":"https://api.github.com/users/rackt/repos","events_url":"https://api.github.com/users/rackt/events{/privacy}","received_events_url":"https://api.github.com/users/rackt/received_events","type":"Organization","site_admin":false},"repo":{"id":19872456,"name":"react-router","full_name":"rackt/react-router","owner":{"login":"rackt","id":8261421,"avatar_url":"https://avatars.githubusercontent.com/u/8261421?v=3","gravatar_id":"","url":"https://api.github.com/users/rackt","html_url":"https://github.com/rackt","followers_url":"https://api.github.com/users/rackt/followers","following_url":"https://api.github.com/users/rackt/following{/other_user}","gists_url":"https://api.github.com/users/rackt/gists{/gist_id}","starred_url":"https://api.github.com/users/rackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackt/subscriptions","organizations_url":"https://api.github.com/users/rackt/orgs","repos_url":"https://api.github.com/users/rackt/repos","events_url":"https://api.github.com/users/rackt/events{/privacy}","received_events_url":"https://api.github.com/users/rackt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackt/react-router","description":"A complete routing solution for React.js","fork":false,"url":"https://api.github.com/repos/rackt/react-router","forks_url":"https://api.github.com/repos/rackt/react-router/forks","keys_url":"https://api.github.com/repos/rackt/react-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackt/react-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackt/react-router/teams","hooks_url":"https://api.github.com/repos/rackt/react-router/hooks","issue_events_url":"https://api.github.com/repos/rackt/react-router/issues/events{/number}","events_url":"https://api.github.com/repos/rackt/react-router/events","assignees_url":"https://api.github.com/repos/rackt/react-router/assignees{/user}","branches_url":"https://api.github.com/repos/rackt/react-router/branches{/branch}","tags_url":"https://api.github.com/repos/rackt/react-router/tags","blobs_url":"https://api.github.com/repos/rackt/react-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackt/react-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackt/react-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackt/react-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackt/react-router/statuses/{sha}","languages_url":"https://api.github.com/repos/rackt/react-router/languages","stargazers_url":"https://api.github.com/repos/rackt/react-router/stargazers","contributors_url":"https://api.github.com/repos/rackt/react-router/contributors","subscribers_url":"https://api.github.com/repos/rackt/react-router/subscribers","subscription_url":"https://api.github.com/repos/rackt/react-router/subscription","commits_url":"https://api.github.com/repos/rackt/react-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackt/react-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackt/react-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackt/react-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackt/react-router/contents/{+path}","compare_url":"https://api.github.com/repos/rackt/react-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackt/react-router/merges","archive_url":"https://api.github.com/repos/rackt/react-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackt/react-router/downloads","issues_url":"https://api.github.com/repos/rackt/react-router/issues{/number}","pulls_url":"https://api.github.com/repos/rackt/react-router/pulls{/number}","milestones_url":"https://api.github.com/repos/rackt/react-router/milestones{/number}","notifications_url":"https://api.github.com/repos/rackt/react-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackt/react-router/labels{/name}","releases_url":"https://api.github.com/repos/rackt/react-router/releases{/id}","created_at":"2014-05-16T22:22:51Z","updated_at":"2015-12-05T18:58:30Z","pushed_at":"2015-12-05T20:20:09Z","git_url":"git://github.com/rackt/react-router.git","ssh_url":"git@github.com:rackt/react-router.git","clone_url":"https://github.com/rackt/react-router.git","svn_url":"https://github.com/rackt/react-router","homepage":"","size":7289,"stargazers_count":8818,"watchers_count":8818,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1603,"mirror_url":null,"open_issues_count":14,"forks":1603,"open_issues":14,"watchers":8818,"default_branch":"master"}},"base":{"label":"rackt:master","ref":"master","sha":"d88579298a21798b4e4e5645e190c8a7b4cf66a3","user":{"login":"rackt","id":8261421,"avatar_url":"https://avatars.githubusercontent.com/u/8261421?v=3","gravatar_id":"","url":"https://api.github.com/users/rackt","html_url":"https://github.com/rackt","followers_url":"https://api.github.com/users/rackt/followers","following_url":"https://api.github.com/users/rackt/following{/other_user}","gists_url":"https://api.github.com/users/rackt/gists{/gist_id}","starred_url":"https://api.github.com/users/rackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackt/subscriptions","organizations_url":"https://api.github.com/users/rackt/orgs","repos_url":"https://api.github.com/users/rackt/repos","events_url":"https://api.github.com/users/rackt/events{/privacy}","received_events_url":"https://api.github.com/users/rackt/received_events","type":"Organization","site_admin":false},"repo":{"id":19872456,"name":"react-router","full_name":"rackt/react-router","owner":{"login":"rackt","id":8261421,"avatar_url":"https://avatars.githubusercontent.com/u/8261421?v=3","gravatar_id":"","url":"https://api.github.com/users/rackt","html_url":"https://github.com/rackt","followers_url":"https://api.github.com/users/rackt/followers","following_url":"https://api.github.com/users/rackt/following{/other_user}","gists_url":"https://api.github.com/users/rackt/gists{/gist_id}","starred_url":"https://api.github.com/users/rackt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackt/subscriptions","organizations_url":"https://api.github.com/users/rackt/orgs","repos_url":"https://api.github.com/users/rackt/repos","events_url":"https://api.github.com/users/rackt/events{/privacy}","received_events_url":"https://api.github.com/users/rackt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackt/react-router","description":"A complete routing solution for React.js","fork":false,"url":"https://api.github.com/repos/rackt/react-router","forks_url":"https://api.github.com/repos/rackt/react-router/forks","keys_url":"https://api.github.com/repos/rackt/react-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackt/react-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackt/react-router/teams","hooks_url":"https://api.github.com/repos/rackt/react-router/hooks","issue_events_url":"https://api.github.com/repos/rackt/react-router/issues/events{/number}","events_url":"https://api.github.com/repos/rackt/react-router/events","assignees_url":"https://api.github.com/repos/rackt/react-router/assignees{/user}","branches_url":"https://api.github.com/repos/rackt/react-router/branches{/branch}","tags_url":"https://api.github.com/repos/rackt/react-router/tags","blobs_url":"https://api.github.com/repos/rackt/react-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackt/react-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackt/react-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackt/react-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackt/react-router/statuses/{sha}","languages_url":"https://api.github.com/repos/rackt/react-router/languages","stargazers_url":"https://api.github.com/repos/rackt/react-router/stargazers","contributors_url":"https://api.github.com/repos/rackt/react-router/contributors","subscribers_url":"https://api.github.com/repos/rackt/react-router/subscribers","subscription_url":"https://api.github.com/repos/rackt/react-router/subscription","commits_url":"https://api.github.com/repos/rackt/react-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackt/react-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackt/react-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackt/react-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackt/react-router/contents/{+path}","compare_url":"https://api.github.com/repos/rackt/react-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackt/react-router/merges","archive_url":"https://api.github.com/repos/rackt/react-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackt/react-router/downloads","issues_url":"https://api.github.com/repos/rackt/react-router/issues{/number}","pulls_url":"https://api.github.com/repos/rackt/react-router/pulls{/number}","milestones_url":"https://api.github.com/repos/rackt/react-router/milestones{/number}","notifications_url":"https://api.github.com/repos/rackt/react-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackt/react-router/labels{/name}","releases_url":"https://api.github.com/repos/rackt/react-router/releases{/id}","created_at":"2014-05-16T22:22:51Z","updated_at":"2015-12-05T18:58:30Z","pushed_at":"2015-12-05T20:20:09Z","git_url":"git://github.com/rackt/react-router.git","ssh_url":"git@github.com:rackt/react-router.git","clone_url":"https://github.com/rackt/react-router.git","svn_url":"https://github.com/rackt/react-router","homepage":"","size":7289,"stargazers_count":8818,"watchers_count":8818,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1603,"mirror_url":null,"open_issues_count":14,"forks":1603,"open_issues":14,"watchers":8818,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackt/react-router/pulls/2647"},"html":{"href":"https://github.com/rackt/react-router/pull/2647"},"issue":{"href":"https://api.github.com/repos/rackt/react-router/issues/2647"},"comments":{"href":"https://api.github.com/repos/rackt/react-router/issues/2647/comments"},"review_comments":{"href":"https://api.github.com/repos/rackt/react-router/pulls/2647/comments"},"review_comment":{"href":"https://api.github.com/repos/rackt/react-router/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackt/react-router/pulls/2647/commits"},"statuses":{"href":"https://api.github.com/repos/rackt/react-router/statuses/8df21386094ff768700e884430baac471c36ecd5"}}}}