{"action":"created","comment":{"url":"https://api.github.com/repos/ca-cwds/intake/pulls/comments/124605767","pull_request_review_id":46911629,"id":124605767,"diff_hunk":"@@ -0,0 +1,131 @@\n+import React from 'react'\n+import {shallow} from 'enzyme'\n+import MaskedInputField from 'components/common/MaskedInputField'\n+\n+describe('MaskedInputField', () => {\n+  let component\n+  let formField\n+  let maskedInput\n+\n+  const onChange = jasmine.createSpy('onChange')\n+  const onBlur = jasmine.createSpy('onBlur')\n+  const props = {\n+    gridClassName: 'myWrapperTest',\n+    labelClassName: 'myLabelTest',\n+    id: 'myInputFieldId',\n+    label: 'this is my label',\n+    onChange: onChange,\n+    onBlur: onBlur,\n+    value: 'this is my field value',\n+    mask: '111-11-1111',\n+  }\n+\n+  describe('without placeholder props', () => {\n+    beforeEach(() => {\n+      component = shallow(<MaskedInputField {...props}/>)\n+      formField = component.find('FormField')\n+      maskedInput = component.find('MaskedInput')\n+    })\n+\n+    it('passes props to the FormField', () => {\n+      expect(formField.props().labelClassName).toEqual('myLabelTest')\n+      expect(formField.props().gridClassName).toEqual('myWrapperTest')\n+      expect(formField.props().id).toEqual('myInputFieldId')\n+      expect(formField.props().label).toEqual('this is my label')\n+      expect(maskedInput.exists()).toEqual(true)\n+    })\n+\n+    it('renders a MaskedInput field', () => {\n+      expect(maskedInput.props().mask).toEqual('111-11-1111')\n+      expect(maskedInput.props().placeholder).toEqual(undefined)\n+    })\n+\n+    it('renders the input value', () => {\n+      expect(maskedInput.props().value).toEqual('this is my field value')\n+    })\n+\n+    it('renders the input type', () => {\n+      const maskedInputWithType = shallow(\n+        <MaskedInputField {...props} type='tel'/>\n+      ).find('MaskedInput')\n+\n+      expect(maskedInput.props().type).toEqual('text')\n+      expect(maskedInputWithType.props().type).toEqual('tel')\n+    })\n+\n+    it('calls onChange when a change event occurs on input field', () => {\n+      maskedInput.simulate('change')\n+      expect(onChange).toHaveBeenCalled()\n+    })\n+\n+    it('calls onBlur when a blur event occurs on input field', () => {\n+      maskedInput.simulate('blur', {target: {value: '1234'}})\n+      expect(onBlur).toHaveBeenCalled()\n+    })\n+  })\n+\n+  describe('with placeholder props', () => {\n+    beforeEach(() => {\n+      const propsWithMaskedInput = {\n+        ...props,\n+        blurPlaceholder: 'I feel lonely :( ',\n+        focusPlaceholder: 'I like attention :) ',\n+      }\n+      component = shallow(<MaskedInputField {...propsWithMaskedInput}/>)\n+    })\n+\n+    it('assigns placeholder props properly', () => {\n+      const inputElement = component.find('MaskedInput')\n+      const event = {target: {placeholder: null}}\n+\n+      expect(inputElement.props().mask).toEqual('111-11-1111')\n+      inputElement.props().onBlur(event)\n+      expect(event.target.placeholder).toEqual('I feel lonely :( ')\n+      inputElement.props().onFocus(event)\n+      expect(event.target.placeholder).toEqual('I like attention :) ')\n+    })\n+  })\n+\n+  describe('when it is not required', () => {\n+    const props = {\n+      gridClassName: 'myWrapperTest',\n+      labelClassName: 'myLabelTest',\n+      id: 'myInputFieldId',\n+      label: 'this is my label',\n+      onChange: onChange,\n+    }\n+\n+    beforeEach(() => {\n+      component = shallow(<MaskedInputField {...props}/>)\n+    })\n+    it('renders an input field', () => {\n+      expect(component.find('label.required').exists()).toEqual(false)\n+      expect(component.find('FormField').props().required).toEqual(undefined)\n+    })\n+  })\n+\n+  describe('when it is required', () => {\n+    const propsWithMaskedInput = {\n+      gridClassName: 'myWrapperTest',\n+      labelClassName: 'myLabelTest',\n+      id: 'myInputFieldId',\n+      label: 'this is my label',\n+      onChange: onChange,\n+      mask: '111-11-1111',\n+      required: true,\n+    }\n+\n+    beforeEach(() => {","path":"spec/javascripts/components/common/MaskedInputFieldSpec.jsx","position":118,"original_position":118,"commit_id":"3f9245866b2d085751a57a3d3f0dc6946a3d730c","original_commit_id":"7147fcfd46077672f93b5d4ca2ddd11bfc9536e7","user":{"login":"saraOSI","id":26719864,"avatar_url":"https://avatars0.githubusercontent.com/u/26719864?v=3","gravatar_id":"","url":"https://api.github.com/users/saraOSI","html_url":"https://github.com/saraOSI","followers_url":"https://api.github.com/users/saraOSI/followers","following_url":"https://api.github.com/users/saraOSI/following{/other_user}","gists_url":"https://api.github.com/users/saraOSI/gists{/gist_id}","starred_url":"https://api.github.com/users/saraOSI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saraOSI/subscriptions","organizations_url":"https://api.github.com/users/saraOSI/orgs","repos_url":"https://api.github.com/users/saraOSI/repos","events_url":"https://api.github.com/users/saraOSI/events{/privacy}","received_events_url":"https://api.github.com/users/saraOSI/received_events","type":"User","site_admin":false},"body":"In this case, no.","created_at":"2017-06-28T17:35:17Z","updated_at":"2017-06-28T17:35:17Z","html_url":"https://github.com/ca-cwds/intake/pull/224#discussion_r124605767","pull_request_url":"https://api.github.com/repos/ca-cwds/intake/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/comments/124605767"},"html":{"href":"https://github.com/ca-cwds/intake/pull/224#discussion_r124605767"},"pull_request":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/ca-cwds/intake/pulls/224","id":127815392,"html_url":"https://github.com/ca-cwds/intake/pull/224","diff_url":"https://github.com/ca-cwds/intake/pull/224.diff","patch_url":"https://github.com/ca-cwds/intake/pull/224.patch","issue_url":"https://api.github.com/repos/ca-cwds/intake/issues/224","number":224,"state":"open","locked":false,"title":"In 147960533 pull masked input new component","user":{"login":"saraOSI","id":26719864,"avatar_url":"https://avatars0.githubusercontent.com/u/26719864?v=3","gravatar_id":"","url":"https://api.github.com/users/saraOSI","html_url":"https://github.com/saraOSI","followers_url":"https://api.github.com/users/saraOSI/followers","following_url":"https://api.github.com/users/saraOSI/following{/other_user}","gists_url":"https://api.github.com/users/saraOSI/gists{/gist_id}","starred_url":"https://api.github.com/users/saraOSI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saraOSI/subscriptions","organizations_url":"https://api.github.com/users/saraOSI/orgs","repos_url":"https://api.github.com/users/saraOSI/repos","events_url":"https://api.github.com/users/saraOSI/events{/privacy}","received_events_url":"https://api.github.com/users/saraOSI/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-27T23:40:28Z","updated_at":"2017-06-28T17:35:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afdb4a9177896337a307341a66bbf2ead49965e5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ca-cwds/intake/pulls/224/commits","review_comments_url":"https://api.github.com/repos/ca-cwds/intake/pulls/224/comments","review_comment_url":"https://api.github.com/repos/ca-cwds/intake/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ca-cwds/intake/issues/224/comments","statuses_url":"https://api.github.com/repos/ca-cwds/intake/statuses/3f9245866b2d085751a57a3d3f0dc6946a3d730c","head":{"label":"ca-cwds:in_147960533_pull_masked_input_new_component","ref":"in_147960533_pull_masked_input_new_component","sha":"3f9245866b2d085751a57a3d3f0dc6946a3d730c","user":{"login":"ca-cwds","id":16274270,"avatar_url":"https://avatars0.githubusercontent.com/u/16274270?v=3","gravatar_id":"","url":"https://api.github.com/users/ca-cwds","html_url":"https://github.com/ca-cwds","followers_url":"https://api.github.com/users/ca-cwds/followers","following_url":"https://api.github.com/users/ca-cwds/following{/other_user}","gists_url":"https://api.github.com/users/ca-cwds/gists{/gist_id}","starred_url":"https://api.github.com/users/ca-cwds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ca-cwds/subscriptions","organizations_url":"https://api.github.com/users/ca-cwds/orgs","repos_url":"https://api.github.com/users/ca-cwds/repos","events_url":"https://api.github.com/users/ca-cwds/events{/privacy}","received_events_url":"https://api.github.com/users/ca-cwds/received_events","type":"Organization","site_admin":false},"repo":{"id":69582220,"name":"intake","full_name":"ca-cwds/intake","owner":{"login":"ca-cwds","id":16274270,"avatar_url":"https://avatars0.githubusercontent.com/u/16274270?v=3","gravatar_id":"","url":"https://api.github.com/users/ca-cwds","html_url":"https://github.com/ca-cwds","followers_url":"https://api.github.com/users/ca-cwds/followers","following_url":"https://api.github.com/users/ca-cwds/following{/other_user}","gists_url":"https://api.github.com/users/ca-cwds/gists{/gist_id}","starred_url":"https://api.github.com/users/ca-cwds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ca-cwds/subscriptions","organizations_url":"https://api.github.com/users/ca-cwds/orgs","repos_url":"https://api.github.com/users/ca-cwds/repos","events_url":"https://api.github.com/users/ca-cwds/events{/privacy}","received_events_url":"https://api.github.com/users/ca-cwds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ca-cwds/intake","description":"The Casebook Intake Accelerator","fork":true,"url":"https://api.github.com/repos/ca-cwds/intake","forks_url":"https://api.github.com/repos/ca-cwds/intake/forks","keys_url":"https://api.github.com/repos/ca-cwds/intake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ca-cwds/intake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ca-cwds/intake/teams","hooks_url":"https://api.github.com/repos/ca-cwds/intake/hooks","issue_events_url":"https://api.github.com/repos/ca-cwds/intake/issues/events{/number}","events_url":"https://api.github.com/repos/ca-cwds/intake/events","assignees_url":"https://api.github.com/repos/ca-cwds/intake/assignees{/user}","branches_url":"https://api.github.com/repos/ca-cwds/intake/branches{/branch}","tags_url":"https://api.github.com/repos/ca-cwds/intake/tags","blobs_url":"https://api.github.com/repos/ca-cwds/intake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ca-cwds/intake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ca-cwds/intake/git/refs{/sha}","trees_url":"https://api.github.com/repos/ca-cwds/intake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ca-cwds/intake/statuses/{sha}","languages_url":"https://api.github.com/repos/ca-cwds/intake/languages","stargazers_url":"https://api.github.com/repos/ca-cwds/intake/stargazers","contributors_url":"https://api.github.com/repos/ca-cwds/intake/contributors","subscribers_url":"https://api.github.com/repos/ca-cwds/intake/subscribers","subscription_url":"https://api.github.com/repos/ca-cwds/intake/subscription","commits_url":"https://api.github.com/repos/ca-cwds/intake/commits{/sha}","git_commits_url":"https://api.github.com/repos/ca-cwds/intake/git/commits{/sha}","comments_url":"https://api.github.com/repos/ca-cwds/intake/comments{/number}","issue_comment_url":"https://api.github.com/repos/ca-cwds/intake/issues/comments{/number}","contents_url":"https://api.github.com/repos/ca-cwds/intake/contents/{+path}","compare_url":"https://api.github.com/repos/ca-cwds/intake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ca-cwds/intake/merges","archive_url":"https://api.github.com/repos/ca-cwds/intake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ca-cwds/intake/downloads","issues_url":"https://api.github.com/repos/ca-cwds/intake/issues{/number}","pulls_url":"https://api.github.com/repos/ca-cwds/intake/pulls{/number}","milestones_url":"https://api.github.com/repos/ca-cwds/intake/milestones{/number}","notifications_url":"https://api.github.com/repos/ca-cwds/intake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ca-cwds/intake/labels{/name}","releases_url":"https://api.github.com/repos/ca-cwds/intake/releases{/id}","deployments_url":"https://api.github.com/repos/ca-cwds/intake/deployments","created_at":"2016-09-29T15:42:09Z","updated_at":"2017-06-14T19:55:10Z","pushed_at":"2017-06-28T17:12:36Z","git_url":"git://github.com/ca-cwds/intake.git","ssh_url":"git@github.com:ca-cwds/intake.git","clone_url":"https://github.com/ca-cwds/intake.git","svn_url":"https://github.com/ca-cwds/intake","homepage":"","size":3843,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":4,"default_branch":"master"}},"base":{"label":"ca-cwds:master","ref":"master","sha":"142863956911b25dadef876f9476f8181c953c27","user":{"login":"ca-cwds","id":16274270,"avatar_url":"https://avatars0.githubusercontent.com/u/16274270?v=3","gravatar_id":"","url":"https://api.github.com/users/ca-cwds","html_url":"https://github.com/ca-cwds","followers_url":"https://api.github.com/users/ca-cwds/followers","following_url":"https://api.github.com/users/ca-cwds/following{/other_user}","gists_url":"https://api.github.com/users/ca-cwds/gists{/gist_id}","starred_url":"https://api.github.com/users/ca-cwds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ca-cwds/subscriptions","organizations_url":"https://api.github.com/users/ca-cwds/orgs","repos_url":"https://api.github.com/users/ca-cwds/repos","events_url":"https://api.github.com/users/ca-cwds/events{/privacy}","received_events_url":"https://api.github.com/users/ca-cwds/received_events","type":"Organization","site_admin":false},"repo":{"id":69582220,"name":"intake","full_name":"ca-cwds/intake","owner":{"login":"ca-cwds","id":16274270,"avatar_url":"https://avatars0.githubusercontent.com/u/16274270?v=3","gravatar_id":"","url":"https://api.github.com/users/ca-cwds","html_url":"https://github.com/ca-cwds","followers_url":"https://api.github.com/users/ca-cwds/followers","following_url":"https://api.github.com/users/ca-cwds/following{/other_user}","gists_url":"https://api.github.com/users/ca-cwds/gists{/gist_id}","starred_url":"https://api.github.com/users/ca-cwds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ca-cwds/subscriptions","organizations_url":"https://api.github.com/users/ca-cwds/orgs","repos_url":"https://api.github.com/users/ca-cwds/repos","events_url":"https://api.github.com/users/ca-cwds/events{/privacy}","received_events_url":"https://api.github.com/users/ca-cwds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ca-cwds/intake","description":"The Casebook Intake Accelerator","fork":true,"url":"https://api.github.com/repos/ca-cwds/intake","forks_url":"https://api.github.com/repos/ca-cwds/intake/forks","keys_url":"https://api.github.com/repos/ca-cwds/intake/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ca-cwds/intake/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ca-cwds/intake/teams","hooks_url":"https://api.github.com/repos/ca-cwds/intake/hooks","issue_events_url":"https://api.github.com/repos/ca-cwds/intake/issues/events{/number}","events_url":"https://api.github.com/repos/ca-cwds/intake/events","assignees_url":"https://api.github.com/repos/ca-cwds/intake/assignees{/user}","branches_url":"https://api.github.com/repos/ca-cwds/intake/branches{/branch}","tags_url":"https://api.github.com/repos/ca-cwds/intake/tags","blobs_url":"https://api.github.com/repos/ca-cwds/intake/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ca-cwds/intake/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ca-cwds/intake/git/refs{/sha}","trees_url":"https://api.github.com/repos/ca-cwds/intake/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ca-cwds/intake/statuses/{sha}","languages_url":"https://api.github.com/repos/ca-cwds/intake/languages","stargazers_url":"https://api.github.com/repos/ca-cwds/intake/stargazers","contributors_url":"https://api.github.com/repos/ca-cwds/intake/contributors","subscribers_url":"https://api.github.com/repos/ca-cwds/intake/subscribers","subscription_url":"https://api.github.com/repos/ca-cwds/intake/subscription","commits_url":"https://api.github.com/repos/ca-cwds/intake/commits{/sha}","git_commits_url":"https://api.github.com/repos/ca-cwds/intake/git/commits{/sha}","comments_url":"https://api.github.com/repos/ca-cwds/intake/comments{/number}","issue_comment_url":"https://api.github.com/repos/ca-cwds/intake/issues/comments{/number}","contents_url":"https://api.github.com/repos/ca-cwds/intake/contents/{+path}","compare_url":"https://api.github.com/repos/ca-cwds/intake/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ca-cwds/intake/merges","archive_url":"https://api.github.com/repos/ca-cwds/intake/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ca-cwds/intake/downloads","issues_url":"https://api.github.com/repos/ca-cwds/intake/issues{/number}","pulls_url":"https://api.github.com/repos/ca-cwds/intake/pulls{/number}","milestones_url":"https://api.github.com/repos/ca-cwds/intake/milestones{/number}","notifications_url":"https://api.github.com/repos/ca-cwds/intake/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ca-cwds/intake/labels{/name}","releases_url":"https://api.github.com/repos/ca-cwds/intake/releases{/id}","deployments_url":"https://api.github.com/repos/ca-cwds/intake/deployments","created_at":"2016-09-29T15:42:09Z","updated_at":"2017-06-14T19:55:10Z","pushed_at":"2017-06-28T17:12:36Z","git_url":"git://github.com/ca-cwds/intake.git","ssh_url":"git@github.com:ca-cwds/intake.git","clone_url":"https://github.com/ca-cwds/intake.git","svn_url":"https://github.com/ca-cwds/intake","homepage":"","size":3843,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/224"},"html":{"href":"https://github.com/ca-cwds/intake/pull/224"},"issue":{"href":"https://api.github.com/repos/ca-cwds/intake/issues/224"},"comments":{"href":"https://api.github.com/repos/ca-cwds/intake/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ca-cwds/intake/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/ca-cwds/intake/statuses/3f9245866b2d085751a57a3d3f0dc6946a3d730c"}}}}
{"actor":{"display_login":"saraOSI"}}