{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/draft-js/pulls/comments/169823113","pull_request_review_id":98412746,"id":169823113,"diff_hunk":"@@ -125,5 +129,25 @@ test('editor selectionstate is updated if new text matches current selection', (\n   expect(editor.update).toHaveBeenCalledTimes(1);\n \n   const newEditorState = editor.update.mock.calls[0][0];\n-  expect(newEditorState.getCurrentContent()).toMatchSnapshot();\n+  expect(newEditorState.getSelection()).toMatchSnapshot();","path":"src/component/handlers/edit/__tests__/editOnBeforeInput.test.js","position":25,"original_position":25,"commit_id":"67fd1235cb66b0d1b56e6215a6e403b3253a1e93","original_commit_id":"67fd1235cb66b0d1b56e6215a6e403b3253a1e93","user":{"login":"existentialism","id":56288,"avatar_url":"https://avatars3.githubusercontent.com/u/56288?v=4","gravatar_id":"","url":"https://api.github.com/users/existentialism","html_url":"https://github.com/existentialism","followers_url":"https://api.github.com/users/existentialism/followers","following_url":"https://api.github.com/users/existentialism/following{/other_user}","gists_url":"https://api.github.com/users/existentialism/gists{/gist_id}","starred_url":"https://api.github.com/users/existentialism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/existentialism/subscriptions","organizations_url":"https://api.github.com/users/existentialism/orgs","repos_url":"https://api.github.com/users/existentialism/repos","events_url":"https://api.github.com/users/existentialism/events{/privacy}","received_events_url":"https://api.github.com/users/existentialism/received_events","type":"User","site_admin":false},"body":"Yeah, the test was originally trying to vet SelectionState specifically, and actually serializing ContentState wasn't correct.","created_at":"2018-02-22T00:29:48Z","updated_at":"2018-02-22T00:29:48Z","html_url":"https://github.com/facebook/draft-js/pull/1661#discussion_r169823113","pull_request_url":"https://api.github.com/repos/facebook/draft-js/pulls/1661","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/comments/169823113"},"html":{"href":"https://github.com/facebook/draft-js/pull/1661#discussion_r169823113"},"pull_request":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/1661"}},"in_reply_to_id":169820843},"pull_request":{"url":"https://api.github.com/repos/facebook/draft-js/pulls/1661","id":170285975,"html_url":"https://github.com/facebook/draft-js/pull/1661","diff_url":"https://github.com/facebook/draft-js/pull/1661.diff","patch_url":"https://github.com/facebook/draft-js/pull/1661.patch","issue_url":"https://api.github.com/repos/facebook/draft-js/issues/1661","number":1661,"state":"open","locked":false,"title":"Ensure selection collapses if user tries to replace with matching text","user":{"login":"existentialism","id":56288,"avatar_url":"https://avatars3.githubusercontent.com/u/56288?v=4","gravatar_id":"","url":"https://api.github.com/users/existentialism","html_url":"https://github.com/existentialism","followers_url":"https://api.github.com/users/existentialism/followers","following_url":"https://api.github.com/users/existentialism/following{/other_user}","gists_url":"https://api.github.com/users/existentialism/gists{/gist_id}","starred_url":"https://api.github.com/users/existentialism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/existentialism/subscriptions","organizations_url":"https://api.github.com/users/existentialism/orgs","repos_url":"https://api.github.com/users/existentialism/repos","events_url":"https://api.github.com/users/existentialism/events{/privacy}","received_events_url":"https://api.github.com/users/existentialism/received_events","type":"User","site_admin":false},"body":"**Summary**\r\n\r\nThis PR ensures that the selection is always collapsed for the cases where a user replaces the current selection with matching text.\r\n\r\nI admittedly didn't really dig into the original issue when fixing the previous crash :)\r\n\r\n**Test Plan**\r\n\r\nSmall repro:\r\n\r\n1. Type in \"abc\"\r\n1. Select \"c\" from right-to-left\r\n1. Type \"c\"\r\n1. Select \"c\" from left-to-right\r\n1. Type \"c\"\r\n\r\nThanks to @JLarky for bringing this to my intention!","created_at":"2018-02-20T19:28:16Z","updated_at":"2018-02-22T00:29:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c67909be373b9b94c3e4be134110f9291105410","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":328912331,"url":"https://api.github.com/repos/facebook/draft-js/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/draft-js/pulls/1661/commits","review_comments_url":"https://api.github.com/repos/facebook/draft-js/pulls/1661/comments","review_comment_url":"https://api.github.com/repos/facebook/draft-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/draft-js/issues/1661/comments","statuses_url":"https://api.github.com/repos/facebook/draft-js/statuses/67fd1235cb66b0d1b56e6215a6e403b3253a1e93","head":{"label":"existentialism:issue398-2","ref":"issue398-2","sha":"67fd1235cb66b0d1b56e6215a6e403b3253a1e93","user":{"login":"existentialism","id":56288,"avatar_url":"https://avatars3.githubusercontent.com/u/56288?v=4","gravatar_id":"","url":"https://api.github.com/users/existentialism","html_url":"https://github.com/existentialism","followers_url":"https://api.github.com/users/existentialism/followers","following_url":"https://api.github.com/users/existentialism/following{/other_user}","gists_url":"https://api.github.com/users/existentialism/gists{/gist_id}","starred_url":"https://api.github.com/users/existentialism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/existentialism/subscriptions","organizations_url":"https://api.github.com/users/existentialism/orgs","repos_url":"https://api.github.com/users/existentialism/repos","events_url":"https://api.github.com/users/existentialism/events{/privacy}","received_events_url":"https://api.github.com/users/existentialism/received_events","type":"User","site_admin":false},"repo":{"id":76802893,"name":"draft-js","full_name":"existentialism/draft-js","owner":{"login":"existentialism","id":56288,"avatar_url":"https://avatars3.githubusercontent.com/u/56288?v=4","gravatar_id":"","url":"https://api.github.com/users/existentialism","html_url":"https://github.com/existentialism","followers_url":"https://api.github.com/users/existentialism/followers","following_url":"https://api.github.com/users/existentialism/following{/other_user}","gists_url":"https://api.github.com/users/existentialism/gists{/gist_id}","starred_url":"https://api.github.com/users/existentialism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/existentialism/subscriptions","organizations_url":"https://api.github.com/users/existentialism/orgs","repos_url":"https://api.github.com/users/existentialism/repos","events_url":"https://api.github.com/users/existentialism/events{/privacy}","received_events_url":"https://api.github.com/users/existentialism/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/existentialism/draft-js","description":"A React framework for building text editors.","fork":true,"url":"https://api.github.com/repos/existentialism/draft-js","forks_url":"https://api.github.com/repos/existentialism/draft-js/forks","keys_url":"https://api.github.com/repos/existentialism/draft-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/existentialism/draft-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/existentialism/draft-js/teams","hooks_url":"https://api.github.com/repos/existentialism/draft-js/hooks","issue_events_url":"https://api.github.com/repos/existentialism/draft-js/issues/events{/number}","events_url":"https://api.github.com/repos/existentialism/draft-js/events","assignees_url":"https://api.github.com/repos/existentialism/draft-js/assignees{/user}","branches_url":"https://api.github.com/repos/existentialism/draft-js/branches{/branch}","tags_url":"https://api.github.com/repos/existentialism/draft-js/tags","blobs_url":"https://api.github.com/repos/existentialism/draft-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/existentialism/draft-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/existentialism/draft-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/existentialism/draft-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/existentialism/draft-js/statuses/{sha}","languages_url":"https://api.github.com/repos/existentialism/draft-js/languages","stargazers_url":"https://api.github.com/repos/existentialism/draft-js/stargazers","contributors_url":"https://api.github.com/repos/existentialism/draft-js/contributors","subscribers_url":"https://api.github.com/repos/existentialism/draft-js/subscribers","subscription_url":"https://api.github.com/repos/existentialism/draft-js/subscription","commits_url":"https://api.github.com/repos/existentialism/draft-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/existentialism/draft-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/existentialism/draft-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/existentialism/draft-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/existentialism/draft-js/contents/{+path}","compare_url":"https://api.github.com/repos/existentialism/draft-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/existentialism/draft-js/merges","archive_url":"https://api.github.com/repos/existentialism/draft-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/existentialism/draft-js/downloads","issues_url":"https://api.github.com/repos/existentialism/draft-js/issues{/number}","pulls_url":"https://api.github.com/repos/existentialism/draft-js/pulls{/number}","milestones_url":"https://api.github.com/repos/existentialism/draft-js/milestones{/number}","notifications_url":"https://api.github.com/repos/existentialism/draft-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/existentialism/draft-js/labels{/name}","releases_url":"https://api.github.com/repos/existentialism/draft-js/releases{/id}","deployments_url":"https://api.github.com/repos/existentialism/draft-js/deployments","created_at":"2016-12-18T19:43:20Z","updated_at":"2016-12-18T19:43:22Z","pushed_at":"2018-02-20T19:21:18Z","git_url":"git://github.com/existentialism/draft-js.git","ssh_url":"git@github.com:existentialism/draft-js.git","clone_url":"https://github.com/existentialism/draft-js.git","svn_url":"https://github.com/existentialism/draft-js","homepage":"https://facebook.github.io/draft-js/","size":4497,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"04c2b9c038cc4086f06bfb734d4cf8e88b4db5d2","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","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":52113921,"name":"draft-js","full_name":"facebook/draft-js","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","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/draft-js","description":"A React framework for building text editors.","fork":false,"url":"https://api.github.com/repos/facebook/draft-js","forks_url":"https://api.github.com/repos/facebook/draft-js/forks","keys_url":"https://api.github.com/repos/facebook/draft-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/draft-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/draft-js/teams","hooks_url":"https://api.github.com/repos/facebook/draft-js/hooks","issue_events_url":"https://api.github.com/repos/facebook/draft-js/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/draft-js/events","assignees_url":"https://api.github.com/repos/facebook/draft-js/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/draft-js/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/draft-js/tags","blobs_url":"https://api.github.com/repos/facebook/draft-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/draft-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/draft-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/draft-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/draft-js/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/draft-js/languages","stargazers_url":"https://api.github.com/repos/facebook/draft-js/stargazers","contributors_url":"https://api.github.com/repos/facebook/draft-js/contributors","subscribers_url":"https://api.github.com/repos/facebook/draft-js/subscribers","subscription_url":"https://api.github.com/repos/facebook/draft-js/subscription","commits_url":"https://api.github.com/repos/facebook/draft-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/draft-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/draft-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/draft-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/draft-js/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/draft-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/draft-js/merges","archive_url":"https://api.github.com/repos/facebook/draft-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/draft-js/downloads","issues_url":"https://api.github.com/repos/facebook/draft-js/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/draft-js/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/draft-js/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/draft-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/draft-js/labels{/name}","releases_url":"https://api.github.com/repos/facebook/draft-js/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/draft-js/deployments","created_at":"2016-02-19T20:18:26Z","updated_at":"2018-02-22T00:24:18Z","pushed_at":"2018-02-20T19:28:17Z","git_url":"git://github.com/facebook/draft-js.git","ssh_url":"git@github.com:facebook/draft-js.git","clone_url":"https://github.com/facebook/draft-js.git","svn_url":"https://github.com/facebook/draft-js","homepage":"https://draftjs.org/","size":5957,"stargazers_count":12136,"watchers_count":12136,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1269,"mirror_url":null,"archived":false,"open_issues_count":495,"license":null,"forks":1269,"open_issues":495,"watchers":12136,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/1661"},"html":{"href":"https://github.com/facebook/draft-js/pull/1661"},"issue":{"href":"https://api.github.com/repos/facebook/draft-js/issues/1661"},"comments":{"href":"https://api.github.com/repos/facebook/draft-js/issues/1661/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/1661/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/draft-js/pulls/1661/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/draft-js/statuses/67fd1235cb66b0d1b56e6215a6e403b3253a1e93"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"existentialism"}}