{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/blueprint/pulls/comments/140104306","pull_request_review_id":64127381,"id":140104306,"diff_hunk":"@@ -0,0 +1,303 @@\n+/*\n+ * Copyright 2017 Palantir Technologies, Inc. All rights reserved.\n+ * Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy\n+ * of the license at https://github.com/palantir/blueprint/blob/master/LICENSE\n+ * and https://github.com/palantir/blueprint/blob/master/PATENTS\n+ */\n+\n+import { assert } from \"chai\";\n+import { mount, shallow, ShallowWrapper } from \"enzyme\";\n+import * as moment from \"moment-timezone\";\n+import * as React from \"react\";\n+\n+import {\n+    Button,\n+    IButtonProps,\n+    IInputGroupProps,\n+    IInputGroupState,\n+    InputGroup,\n+    IPopoverProps,\n+    IPopoverState,\n+    MenuItem,\n+    Popover,\n+} from \"@blueprintjs/core\";\n+import {\n+    getInitialTimezoneItems,\n+    getLocalTimezoneItem,\n+    getTimezoneItems,\n+    ITimezoneItem,\n+} from \"../src/components/timezone-picker/timezoneItems\";\n+import {\n+    IQueryListProps,\n+    IQueryListState,\n+    ISelectProps,\n+    ISelectState,\n+    ITimezonePickerProps,\n+    ITimezonePickerState,\n+    QueryList,\n+    Select,\n+    TimezoneDisplayFormat,\n+    TimezonePicker,\n+} from \"../src/index\";\n+\n+type TimezonePickerShallowWrapper = ShallowWrapper<ITimezonePickerProps, ITimezonePickerState>;\n+type SelectShallowWrapper = ShallowWrapper<ISelectProps<ITimezoneItem>, ISelectState<ITimezoneItem>>;\n+type QueryListShallowWrapper = ShallowWrapper<IQueryListProps<ITimezoneItem>, IQueryListState<ITimezoneItem>>;\n+type PopoverShallowWrapper = ShallowWrapper<IPopoverProps, IPopoverState>;\n+type InputGroupShallowWrapper = ShallowWrapper<IInputGroupProps, IInputGroupState>;\n+\n+describe(\"<TimezonePicker>\", () => {\n+    it(\"clicking on button target opens popover\", () => {\n+        const timezonePicker = mount(<TimezonePicker popoverProps={{ inline: true }} />);\n+        const button = timezonePicker.find(Button);\n+        button.simulate(\"click\");\n+        const popover = timezonePicker.find(Popover);\n+        assert.isTrue(popover.prop(\"isOpen\"));\n+    });\n+\n+    it(\"clicking on button target does not open popover when disabled\", () => {\n+        const timezonePicker = mount(<TimezonePicker disabled={true} popoverProps={{ inline: true }} />);\n+        const button = timezonePicker.find(Button);\n+        button.simulate(\"click\");\n+        const popover = timezonePicker.find(Popover);\n+        assert.isFalse(popover.prop(\"isOpen\"));\n+    });\n+\n+    it(\"placeholder prop changes the filter placeholder text\", () => {\n+        const placeholder = \"test placeholder\";\n+        const timezonePicker = shallow(\n+            <TimezonePicker popoverProps={{ isOpen: true, inline: true }} inputProps={{ placeholder }} />,\n+        );\n+        const inputGroup = findInputGroup(timezonePicker);\n+        assert.strictEqual(inputGroup.prop(\"placeholder\"), placeholder);\n+    });\n+\n+    it(\"shows initial items when the query is empty\", () => {\n+        let select: SelectShallowWrapper;\n+        const date = new Date();\n+        const timezonePicker = shallow(<TimezonePicker date={date} popoverProps={{ isOpen: true, inline: true }} />);\n+        select = findSelect(timezonePicker);\n+        const items = select.prop(\"items\");\n+        assert.deepEqual(items, getInitialTimezoneItems(date, true));\n+    });\n+\n+    it(\"shows all items when the query is non-empty\", () => {\n+        const date = new Date();\n+        const query = \"test query\";\n+        const timezonePicker = shallow(\n+            <TimezonePicker date={date} popoverProps={{ isOpen: true, inline: true }} inputProps={{ value: query }} />,\n+        );\n+        assert.strictEqual(timezonePicker.state(\"query\"), query);\n+        const select = findSelect(timezonePicker);\n+        const items = select.prop(\"items\");\n+        assert.deepEqual(items, getTimezoneItems(date));\n+    });\n+\n+    it(\"uses the same items between non-empty query changes\", () => {\n+        let select: SelectShallowWrapper;\n+        let inputGroup: InputGroupShallowWrapper;\n+\n+        const timezonePicker = shallow(<TimezonePicker popoverProps={{ isOpen: true, inline: true }} />);\n+\n+        inputGroup = findInputGroup(timezonePicker);\n+        const query1 = \"test query 1\";\n+        inputGroup.simulate(\"change\", { currentTarget: { value: query1 } });\n+        assert.strictEqual(timezonePicker.state(\"query\"), query1);\n+\n+        select = findSelect(timezonePicker);\n+        const items1 = select.prop(\"items\");\n+\n+        inputGroup = findInputGroup(timezonePicker);\n+        const query2 = \"test query 2\";\n+        inputGroup.simulate(\"change\", { currentTarget: { value: query2 } });\n+        assert.strictEqual(timezonePicker.state(\"query\"), query2);\n+\n+        select = findSelect(timezonePicker);\n+        const items2 = select.prop(\"items\");\n+\n+        assert.strictEqual(items1, items2);\n+    });\n+\n+    it(\"renders local timezone at top of item list if show local timezone is enabled\", () => {\n+        const timezonePicker = shallow(\n+            <TimezonePicker popoverProps={{ isOpen: true, inline: true }} showLocalTimezone={true} />,\n+        );\n+        const select = findSelect(timezonePicker);\n+        const items = select.prop(\"items\");\n+        assert.isTrue(items.length > 0);\n+        const firstItem = items[0];\n+        assert.strictEqual(firstItem.timezone, moment.tz.guess());\n+    });\n+\n+    it(\"does not render local timezone at top of item list if show local timezone is disabled\", () => {","path":"packages/labs/test/timezonePickerTests.tsx","position":132,"original_position":132,"commit_id":"76fccc23af1e3d5fb31cd85fd8470a2bf5193349","original_commit_id":"76fccc23af1e3d5fb31cd85fd8470a2bf5193349","user":{"login":"giladgray","id":464822,"avatar_url":"https://avatars1.githubusercontent.com/u/464822?v=4","gravatar_id":"","url":"https://api.github.com/users/giladgray","html_url":"https://github.com/giladgray","followers_url":"https://api.github.com/users/giladgray/followers","following_url":"https://api.github.com/users/giladgray/following{/other_user}","gists_url":"https://api.github.com/users/giladgray/gists{/gist_id}","starred_url":"https://api.github.com/users/giladgray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giladgray/subscriptions","organizations_url":"https://api.github.com/users/giladgray/orgs","repos_url":"https://api.github.com/users/giladgray/repos","events_url":"https://api.github.com/users/giladgray/events{/privacy}","received_events_url":"https://api.github.com/users/giladgray/received_events","type":"User","site_admin":false},"body":"use prop name in test name: `if showLocalTimezone=false` \r\nthis comment applies widely to this file.","created_at":"2017-09-20T22:00:39Z","updated_at":"2017-09-20T22:06:57Z","html_url":"https://github.com/palantir/blueprint/pull/1568#discussion_r140104306","pull_request_url":"https://api.github.com/repos/palantir/blueprint/pulls/1568","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/comments/140104306"},"html":{"href":"https://github.com/palantir/blueprint/pull/1568#discussion_r140104306"},"pull_request":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/1568"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/blueprint/pulls/1568","id":141156750,"html_url":"https://github.com/palantir/blueprint/pull/1568","diff_url":"https://github.com/palantir/blueprint/pull/1568.diff","patch_url":"https://github.com/palantir/blueprint/pull/1568.patch","issue_url":"https://api.github.com/repos/palantir/blueprint/issues/1568","number":1568,"state":"open","locked":false,"title":"[Labs] Timezone Picker","user":{"login":"brieb","id":723547,"avatar_url":"https://avatars2.githubusercontent.com/u/723547?v=4","gravatar_id":"","url":"https://api.github.com/users/brieb","html_url":"https://github.com/brieb","followers_url":"https://api.github.com/users/brieb/followers","following_url":"https://api.github.com/users/brieb/following{/other_user}","gists_url":"https://api.github.com/users/brieb/gists{/gist_id}","starred_url":"https://api.github.com/users/brieb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brieb/subscriptions","organizations_url":"https://api.github.com/users/brieb/orgs","repos_url":"https://api.github.com/users/brieb/repos","events_url":"https://api.github.com/users/brieb/events{/privacy}","received_events_url":"https://api.github.com/users/brieb/received_events","type":"User","site_admin":false},"body":"#### Fixes part of #890\r\n\r\nOut of scope for this PR: Incorporating with the other datetime components\r\n\r\n#### Checklist\r\n\r\n- [x] Include tests\r\n- [x] Update documentation\r\n\r\n#### Changes proposed in this pull request:\r\n\r\nTimezone select component\r\n","created_at":"2017-09-14T19:24:21Z","updated_at":"2017-09-20T22:06:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc0f4a0f755d4d02ea22e0c054c2b714eaefccec","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/blueprint/pulls/1568/commits","review_comments_url":"https://api.github.com/repos/palantir/blueprint/pulls/1568/comments","review_comment_url":"https://api.github.com/repos/palantir/blueprint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/blueprint/issues/1568/comments","statuses_url":"https://api.github.com/repos/palantir/blueprint/statuses/76fccc23af1e3d5fb31cd85fd8470a2bf5193349","head":{"label":"palantir:bb/timezone","ref":"bb/timezone","sha":"76fccc23af1e3d5fb31cd85fd8470a2bf5193349","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":71939872,"name":"blueprint","full_name":"palantir/blueprint","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/blueprint","description":"A React-based UI toolkit for the web","fork":false,"url":"https://api.github.com/repos/palantir/blueprint","forks_url":"https://api.github.com/repos/palantir/blueprint/forks","keys_url":"https://api.github.com/repos/palantir/blueprint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/blueprint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/blueprint/teams","hooks_url":"https://api.github.com/repos/palantir/blueprint/hooks","issue_events_url":"https://api.github.com/repos/palantir/blueprint/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/blueprint/events","assignees_url":"https://api.github.com/repos/palantir/blueprint/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/blueprint/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/blueprint/tags","blobs_url":"https://api.github.com/repos/palantir/blueprint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/blueprint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/blueprint/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/blueprint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/blueprint/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/blueprint/languages","stargazers_url":"https://api.github.com/repos/palantir/blueprint/stargazers","contributors_url":"https://api.github.com/repos/palantir/blueprint/contributors","subscribers_url":"https://api.github.com/repos/palantir/blueprint/subscribers","subscription_url":"https://api.github.com/repos/palantir/blueprint/subscription","commits_url":"https://api.github.com/repos/palantir/blueprint/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/blueprint/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/blueprint/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/blueprint/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/blueprint/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/blueprint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/blueprint/merges","archive_url":"https://api.github.com/repos/palantir/blueprint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/blueprint/downloads","issues_url":"https://api.github.com/repos/palantir/blueprint/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/blueprint/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/blueprint/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/blueprint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/blueprint/labels{/name}","releases_url":"https://api.github.com/repos/palantir/blueprint/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/blueprint/deployments","created_at":"2016-10-25T21:17:50Z","updated_at":"2017-09-20T21:50:43Z","pushed_at":"2017-09-20T21:34:05Z","git_url":"git://github.com/palantir/blueprint.git","ssh_url":"git@github.com:palantir/blueprint.git","clone_url":"https://github.com/palantir/blueprint.git","svn_url":"https://github.com/palantir/blueprint","homepage":"http://blueprintjs.com/","size":50420,"stargazers_count":6943,"watchers_count":6943,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":410,"mirror_url":null,"open_issues_count":292,"forks":410,"open_issues":292,"watchers":6943,"default_branch":"master"}},"base":{"label":"palantir:master","ref":"master","sha":"874b757e729576a330ee3a8b67a382c7ff4a312e","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":71939872,"name":"blueprint","full_name":"palantir/blueprint","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars0.githubusercontent.com/u/303157?v=4","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/blueprint","description":"A React-based UI toolkit for the web","fork":false,"url":"https://api.github.com/repos/palantir/blueprint","forks_url":"https://api.github.com/repos/palantir/blueprint/forks","keys_url":"https://api.github.com/repos/palantir/blueprint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/blueprint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/blueprint/teams","hooks_url":"https://api.github.com/repos/palantir/blueprint/hooks","issue_events_url":"https://api.github.com/repos/palantir/blueprint/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/blueprint/events","assignees_url":"https://api.github.com/repos/palantir/blueprint/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/blueprint/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/blueprint/tags","blobs_url":"https://api.github.com/repos/palantir/blueprint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/blueprint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/blueprint/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/blueprint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/blueprint/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/blueprint/languages","stargazers_url":"https://api.github.com/repos/palantir/blueprint/stargazers","contributors_url":"https://api.github.com/repos/palantir/blueprint/contributors","subscribers_url":"https://api.github.com/repos/palantir/blueprint/subscribers","subscription_url":"https://api.github.com/repos/palantir/blueprint/subscription","commits_url":"https://api.github.com/repos/palantir/blueprint/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/blueprint/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/blueprint/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/blueprint/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/blueprint/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/blueprint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/blueprint/merges","archive_url":"https://api.github.com/repos/palantir/blueprint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/blueprint/downloads","issues_url":"https://api.github.com/repos/palantir/blueprint/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/blueprint/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/blueprint/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/blueprint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/blueprint/labels{/name}","releases_url":"https://api.github.com/repos/palantir/blueprint/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/blueprint/deployments","created_at":"2016-10-25T21:17:50Z","updated_at":"2017-09-20T21:50:43Z","pushed_at":"2017-09-20T21:34:05Z","git_url":"git://github.com/palantir/blueprint.git","ssh_url":"git@github.com:palantir/blueprint.git","clone_url":"https://github.com/palantir/blueprint.git","svn_url":"https://github.com/palantir/blueprint","homepage":"http://blueprintjs.com/","size":50420,"stargazers_count":6943,"watchers_count":6943,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":410,"mirror_url":null,"open_issues_count":292,"forks":410,"open_issues":292,"watchers":6943,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/1568"},"html":{"href":"https://github.com/palantir/blueprint/pull/1568"},"issue":{"href":"https://api.github.com/repos/palantir/blueprint/issues/1568"},"comments":{"href":"https://api.github.com/repos/palantir/blueprint/issues/1568/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/1568/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/blueprint/pulls/1568/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/blueprint/statuses/76fccc23af1e3d5fb31cd85fd8470a2bf5193349"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"giladgray"}}