@messenger-box/platform-browser 10.0.3-alpha.17 → 10.0.3-alpha.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/InboxMessage/InboxDetails/index.d.ts +6 -1
- package/lib/components/InboxMessage/InboxDetails/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/InboxDetails/index.js +10 -11
- package/lib/components/InboxMessage/InboxDetails/index.js.map +1 -1
- package/lib/components/InboxMessage/InboxSidebar/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/InboxSidebar/index.js +23 -32
- package/lib/components/InboxMessage/InboxSidebar/index.js.map +1 -1
- package/lib/components/InboxMessage/Messages/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/Messages/index.js +42 -81
- package/lib/components/InboxMessage/Messages/index.js.map +1 -1
- package/lib/components/InboxMessage/MessagesList/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/MessagesList/index.js +53 -74
- package/lib/components/InboxMessage/MessagesList/index.js.map +1 -1
- package/lib/components/InboxMessage/Popover/index.d.ts +5 -1
- package/lib/components/InboxMessage/Popover/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/Popover/index.js +8 -35
- package/lib/components/InboxMessage/Popover/index.js.map +1 -1
- package/lib/components/InboxMessage/UserModalContent/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/UserModalContent/index.js +50 -47
- package/lib/components/InboxMessage/UserModalContent/index.js.map +1 -1
- package/lib/components/InboxMessage/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/index.js +38 -70
- package/lib/components/InboxMessage/index.js.map +1 -1
- package/lib/components/channel_view/DirectChannelView.js.map +1 -1
- package/lib/components/channel_view/PublicChannelView.js.map +1 -1
- package/lib/components/dashboard/menu_header.d.ts.map +1 -1
- package/lib/components/dashboard/menu_header.js +38 -24
- package/lib/components/dashboard/menu_header.js.map +1 -1
- package/lib/components/dashboard/modals/direct_modal.d.ts +10 -8
- package/lib/components/dashboard/modals/direct_modal.d.ts.map +1 -1
- package/lib/components/dashboard/modals/direct_modal.js +59 -39
- package/lib/components/dashboard/modals/direct_modal.js.map +1 -1
- package/lib/components/dashboard/modals.d.ts +18 -6
- package/lib/components/dashboard/modals.d.ts.map +1 -1
- package/lib/components/dashboard/modals.js +60 -101
- package/lib/components/dashboard/modals.js.map +1 -1
- package/lib/components/messenger/avatar/index.d.ts.map +1 -1
- package/lib/components/messenger/index.d.ts.map +1 -1
- package/lib/components/messenger/index.js +45 -82
- package/lib/components/messenger/index.js.map +1 -1
- package/lib/components/messenger/messagesList/index.d.ts.map +1 -1
- package/lib/components/messenger/messagesList/index.js +174 -454
- package/lib/components/messenger/messagesList/index.js.map +1 -1
- package/lib/components/messenger/messagesList/messageBox.d.ts +0 -1
- package/lib/components/messenger/messagesList/messageBox.d.ts.map +1 -1
- package/lib/components/messenger/more_action/index.d.ts.map +1 -1
- package/lib/components/messenger/postMessage/postMessage.d.ts +7 -2
- package/lib/components/messenger/postMessage/postMessage.d.ts.map +1 -1
- package/lib/components/messenger/sidebarThreadList/index.d.ts.map +1 -1
- package/lib/components/messenger/threadSidebar/index.d.ts.map +1 -1
- package/lib/components/messenger/types/message.d.ts +11 -11
- package/lib/components/messenger/types/message.d.ts.map +1 -1
- package/lib/components/post/channel_intro_message/channel_intro_message.d.ts.map +1 -1
- package/lib/components/post/channel_layout/channel_identifier_router/channel_identifier_router.d.ts.map +1 -1
- package/lib/components/post/channel_view/channel_view.d.ts.map +1 -1
- package/lib/components/post/create_post/create_post.d.ts +10 -1
- package/lib/components/post/create_post/create_post.d.ts.map +1 -1
- package/lib/components/post/failed_post_options/failed_post_options.d.ts.map +1 -1
- package/lib/components/post/index.d.ts +5 -3
- package/lib/components/post/index.d.ts.map +1 -1
- package/lib/components/post/index.js +63 -97
- package/lib/components/post/index.js.map +1 -1
- package/lib/components/post/markdown/markdown.d.ts.map +1 -1
- package/lib/components/post/post/post.d.ts.map +1 -1
- package/lib/components/post/post_body/post_body.d.ts.map +1 -1
- package/lib/components/post/post_body_additional_content/post_body_additional_content.d.ts.map +1 -1
- package/lib/components/post/post_header/post_header.d.ts.map +1 -1
- package/lib/components/post/post_header/post_header_custom_status.d.ts.map +1 -1
- package/lib/components/post/post_info/post_info.d.ts.map +1 -1
- package/lib/components/post/post_list/post_list.d.ts.map +1 -1
- package/lib/components/post/post_list_row/post_list_row.d.ts.map +1 -1
- package/lib/components/post/post_list_virtualized/post_list_virtualized.d.ts.map +1 -1
- package/lib/components/post/post_markdown/post_markdown.d.ts.map +1 -1
- package/lib/components/post/post_message_view/post_message_view.d.ts.map +1 -1
- package/lib/components/post/post_pre_header/post_pre_header.d.ts.map +1 -1
- package/lib/components/post/post_profile_picture/post_profile_picture.d.ts.map +1 -1
- package/lib/components/post/profile_picture/profile_picture.d.ts.map +1 -1
- package/lib/components/post/show_more/show_more.d.ts.map +1 -1
- package/lib/components/post/suggestion/suggestion_box.d.ts.map +1 -1
- package/lib/components/post/textbox/textbox.d.ts.map +1 -1
- package/lib/components/post/threading/channel_threads/thread_footer/thread_footer.d.ts.map +1 -1
- package/lib/components/post/tutorial/menu_tutorial_tip.d.ts.map +1 -1
- package/lib/components/post/tutorial/tutorial_tip/tutorial_tip.d.ts.map +1 -1
- package/lib/components/post_view/post_attachment_container/post_attachment_container.d.ts.map +1 -1
- package/lib/components/status_icon.d.ts.map +1 -1
- package/lib/compute.js.map +1 -1
- package/lib/containers/Dashboard.d.ts.map +1 -1
- package/lib/containers/Dashboard.js +110 -124
- package/lib/containers/Dashboard.js.map +1 -1
- package/lib/containers/DashboardWithLoader.d.ts.map +1 -1
- package/lib/containers/DashboardWithLoader.js +14 -5
- package/lib/containers/DashboardWithLoader.js.map +1 -1
- package/lib/containers/Inbox.js.map +1 -1
- package/lib/containers/Messenger.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/widgets/simple_tooltip/simple_tooltip.d.ts.map +1 -1
- package/package.json +5 -5
- package/CHANGELOG.md +0 -135
- package/jest.config.js +0 -24
- package/lib/components/InboxMessage/InboxDetails/style.d.ts +0 -2
- package/lib/components/InboxMessage/InboxDetails/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/InboxDetails/style.js +0 -27
- package/lib/components/InboxMessage/InboxDetails/style.js.map +0 -1
- package/lib/components/InboxMessage/InboxSidebar/styles.d.ts +0 -2
- package/lib/components/InboxMessage/InboxSidebar/styles.d.ts.map +0 -1
- package/lib/components/InboxMessage/InboxSidebar/styles.js +0 -57
- package/lib/components/InboxMessage/InboxSidebar/styles.js.map +0 -1
- package/lib/components/InboxMessage/Messages/styles.d.ts +0 -81
- package/lib/components/InboxMessage/Messages/styles.d.ts.map +0 -1
- package/lib/components/InboxMessage/Messages/styles.js +0 -85
- package/lib/components/InboxMessage/Messages/styles.js.map +0 -1
- package/lib/components/InboxMessage/Popover/style.d.ts +0 -28
- package/lib/components/InboxMessage/Popover/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/Popover/style.js +0 -27
- package/lib/components/InboxMessage/Popover/style.js.map +0 -1
- package/lib/components/InboxMessage/UserModalContent/style.d.ts +0 -2
- package/lib/components/InboxMessage/UserModalContent/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/UserModalContent/style.js +0 -98
- package/lib/components/InboxMessage/UserModalContent/style.js.map +0 -1
- package/lib/components/InboxMessage/style.js +0 -189
- package/lib/components/InboxMessage/style.js.map +0 -1
- package/lib/components/messenger/avatar/style.d.ts +0 -2
- package/lib/components/messenger/avatar/style.d.ts.map +0 -1
- package/lib/components/messenger/messagesList/style.js +0 -446
- package/lib/components/messenger/messagesList/style.js.map +0 -1
- package/lib/components/messenger/more_action/index.js +0 -48
- package/lib/components/messenger/more_action/index.js.map +0 -1
- package/lib/components/messenger/more_action/style.d.ts +0 -2
- package/lib/components/messenger/more_action/style.d.ts.map +0 -1
- package/lib/components/messenger/more_action/style.js +0 -45
- package/lib/components/messenger/more_action/style.js.map +0 -1
- package/lib/components/post/style.js +0 -20101
- package/lib/components/post/style.js.map +0 -1
- package/lib/style.js +0 -400
- package/lib/style.js.map +0 -1
- package/rollup.config.mjs +0 -35
- package/src/cdm-locales/en/translations.json +0 -95
- package/src/cdm-locales/es/translations.json +0 -95
- package/src/components/InboxMessage/InboxDetails/index.tsx +0 -25
- package/src/components/InboxMessage/InboxDetails/style.ts +0 -27
- package/src/components/InboxMessage/InboxSidebar/index.tsx +0 -89
- package/src/components/InboxMessage/InboxSidebar/styles.ts +0 -57
- package/src/components/InboxMessage/Messages/index.tsx +0 -161
- package/src/components/InboxMessage/Messages/styles.ts +0 -85
- package/src/components/InboxMessage/MessagesList/index.tsx +0 -93
- package/src/components/InboxMessage/Popover/index.tsx +0 -60
- package/src/components/InboxMessage/Popover/style.ts +0 -27
- package/src/components/InboxMessage/UserModalContent/index.tsx +0 -63
- package/src/components/InboxMessage/UserModalContent/style.ts +0 -98
- package/src/components/InboxMessage/index.tsx +0 -289
- package/src/components/InboxMessage/mock.ts +0 -53
- package/src/components/InboxMessage/style.ts +0 -189
- package/src/components/NavBar.tsx +0 -10
- package/src/components/channel_view/DirectChannelView.tsx +0 -25
- package/src/components/channel_view/PublicChannelView.tsx +0 -25
- package/src/components/dashboard/menu_header.tsx +0 -62
- package/src/components/dashboard/modals/direct_modal.tsx +0 -54
- package/src/components/dashboard/modals.tsx +0 -121
- package/src/components/messenger/avatar/index.tsx +0 -39
- package/src/components/messenger/avatar/style.ts +0 -86
- package/src/components/messenger/index.tsx +0 -382
- package/src/components/messenger/messagesList/index.tsx +0 -764
- package/src/components/messenger/messagesList/messageBox.tsx +0 -66
- package/src/components/messenger/messagesList/style.ts +0 -448
- package/src/components/messenger/mock.ts +0 -77
- package/src/components/messenger/more_action/index.tsx +0 -79
- package/src/components/messenger/more_action/style.ts +0 -45
- package/src/components/messenger/postMessage/postMessage.tsx +0 -28
- package/src/components/messenger/postMessage/style.ts +0 -24
- package/src/components/messenger/sidebarThreadList/index.tsx +0 -201
- package/src/components/messenger/style.ts +0 -40
- package/src/components/messenger/threadSidebar/index.tsx +0 -129
- package/src/components/messenger/threadSidebar/style.ts +0 -65
- package/src/components/messenger/types/message.ts +0 -16
- package/src/components/messenger/utils/utils.ts +0 -5
- package/src/components/overlay_trigger.tsx +0 -59
- package/src/components/post/channel_intro_message/add_members_button.tsx +0 -152
- package/src/components/post/channel_intro_message/channel_intro_message.tsx +0 -53
- package/src/components/post/channel_intro_message/index.ts +0 -1
- package/src/components/post/channel_layout/center_channel/center_channel.test.tsx +0 -50
- package/src/components/post/channel_layout/center_channel/center_channel.tsx +0 -125
- package/src/components/post/channel_layout/center_channel/index.ts +0 -69
- package/src/components/post/channel_layout/channel_controller.test.tsx +0 -76
- package/src/components/post/channel_layout/channel_controller.tsx +0 -85
- package/src/components/post/channel_layout/channel_identifier_router/actions.test.ts +0 -243
- package/src/components/post/channel_layout/channel_identifier_router/actions.ts +0 -353
- package/src/components/post/channel_layout/channel_identifier_router/channel_identifier_router.test.tsx +0 -101
- package/src/components/post/channel_layout/channel_identifier_router/channel_identifier_router.tsx +0 -6
- package/src/components/post/channel_layout/channel_identifier_router/index.ts +0 -1
- package/src/components/post/channel_view/channel_view.test.tsx +0 -68
- package/src/components/post/channel_view/channel_view.tsx +0 -92
- package/src/components/post/channel_view/index.ts +0 -1
- package/src/components/post/create_post/create_post.test.jsx +0 -1335
- package/src/components/post/create_post/create_post.tsx +0 -225
- package/src/components/post/create_post/index.ts +0 -1
- package/src/components/post/failed_post_options/failed_post_options.tsx +0 -32
- package/src/components/post/failed_post_options/index.ts +0 -4
- package/src/components/post/index.tsx +0 -131
- package/src/components/post/markdown/index.ts +0 -1
- package/src/components/post/markdown/markdown.test.tsx +0 -62
- package/src/components/post/markdown/markdown.tsx +0 -38
- package/src/components/post/post/defaultpost.ts +0 -25
- package/src/components/post/post/post.tsx +0 -270
- package/src/components/post/post/style.ts +0 -0
- package/src/components/post/post_aria_label_div.tsx +0 -43
- package/src/components/post/post_body/post_body.tsx +0 -80
- package/src/components/post/post_body_additional_content/post_body_additional_content.tsx +0 -6
- package/src/components/post/post_context.tsx +0 -10
- package/src/components/post/post_header/index.ts +0 -38
- package/src/components/post/post_header/post_header.scss +0 -53
- package/src/components/post/post_header/post_header.tsx +0 -98
- package/src/components/post/post_header/post_header_custom_status.tsx +0 -49
- package/src/components/post/post_header/style.ts +0 -54
- package/src/components/post/post_info/post_info.tsx +0 -195
- package/src/components/post/post_list/index.tsx +0 -10
- package/src/components/post/post_list/post_list.tsx +0 -27
- package/src/components/post/post_list_row/index.ts +0 -42
- package/src/components/post/post_list_row/post_list_row.test.tsx +0 -176
- package/src/components/post/post_list_row/post_list_row.tsx +0 -130
- package/src/components/post/post_list_virtualized/latest_post_reader.tsx +0 -9
- package/src/components/post/post_list_virtualized/post_list_virtualized.tsx +0 -269
- package/src/components/post/post_markdown/index.test.js +0 -119
- package/src/components/post/post_markdown/index.ts +0 -1
- package/src/components/post/post_markdown/post_markdown.test.tsx +0 -178
- package/src/components/post/post_markdown/post_markdown.tsx +0 -58
- package/src/components/post/post_markdown/system_message_helpers.tsx +0 -420
- package/src/components/post/post_message_view/index.ts +0 -4
- package/src/components/post/post_message_view/post_message_view.test.tsx +0 -89
- package/src/components/post/post_message_view/post_message_view.tsx +0 -71
- package/src/components/post/post_pre_header/post_pre_header.tsx +0 -141
- package/src/components/post/post_profile_picture/post_profile_picture.tsx +0 -95
- package/src/components/post/post_view.tsx +0 -10
- package/src/components/post/profile_picture/profile_picture.tsx +0 -21
- package/src/components/post/show_more/index.ts +0 -1
- package/src/components/post/show_more/show_more.test.tsx +0 -102
- package/src/components/post/show_more/show_more.tsx +0 -97
- package/src/components/post/style.ts +0 -20101
- package/src/components/post/suggestion/suggestion_box.tsx +0 -5
- package/src/components/post/textbox/index.ts +0 -1
- package/src/components/post/textbox/textbox.tsx +0 -80
- package/src/components/post/textbox/textbox_links/index.ts +0 -24
- package/src/components/post/textbox/textbox_links/textbox_links.tsx +0 -143
- package/src/components/post/threading/channel_threads/thread_footer/index.ts +0 -4
- package/src/components/post/threading/channel_threads/thread_footer/thread_footer.scss +0 -72
- package/src/components/post/threading/channel_threads/thread_footer/thread_footer.tsx +0 -206
- package/src/components/post/threading/common/button/__snapshots__/button.test.tsx.snap +0 -68
- package/src/components/post/threading/common/button/button.scss +0 -148
- package/src/components/post/threading/common/button/button.test.tsx +0 -75
- package/src/components/post/threading/common/button/button.tsx +0 -51
- package/src/components/post/threading/common/button/index.ts +0 -4
- package/src/components/post/threading/common/follow_button/__snapshots__/follow_button.test.tsx.snap +0 -50
- package/src/components/post/threading/common/follow_button/follow_button.test.tsx +0 -56
- package/src/components/post/threading/common/follow_button/follow_button.tsx +0 -39
- package/src/components/post/threading/common/follow_button/index.ts +0 -4
- package/src/components/post/timestamp/__snapshots__/semantic_time.test.tsx.snap +0 -13
- package/src/components/post/timestamp/__snapshots__/timestamp.test.tsx.snap +0 -13
- package/src/components/post/timestamp/index.ts +0 -50
- package/src/components/post/timestamp/relative_ranges.tsx +0 -58
- package/src/components/post/timestamp/semantic_time.test.tsx +0 -47
- package/src/components/post/timestamp/semantic_time.tsx +0 -28
- package/src/components/post/timestamp/timestamp.stories.tsx +0 -190
- package/src/components/post/timestamp/timestamp.test.tsx +0 -309
- package/src/components/post/timestamp/timestamp.tsx +0 -441
- package/src/components/post/tutorial/menu_tutorial_tip.tsx +0 -63
- package/src/components/post/tutorial/tutorial_tip/index.ts +0 -0
- package/src/components/post/tutorial/tutorial_tip/tutorial_tip.test.tsx +0 -111
- package/src/components/post/tutorial/tutorial_tip/tutorial_tip.tsx +0 -224
- package/src/components/post/user_profile/index.tsx +0 -6
- package/src/components/post/user_profile/user_profile.tsx +0 -114
- package/src/components/post_view/__snapshots__/post_view.test.js.snap +0 -25
- package/src/components/post_view/channel_intro_message/add_members_button.scss +0 -72
- package/src/components/post_view/channel_intro_message/add_members_button.tsx +0 -152
- package/src/components/post_view/channel_intro_message/channel_intro_message.tsx +0 -549
- package/src/components/post_view/channel_intro_message/index.ts +0 -67
- package/src/components/post_view/combined_system_message/__snapshots__/combined_system_message.test.tsx.snap +0 -238
- package/src/components/post_view/combined_system_message/__snapshots__/last_users.test.tsx.snap +0 -74
- package/src/components/post_view/combined_system_message/combined_system_message.test.tsx +0 -167
- package/src/components/post_view/combined_system_message/combined_system_message.tsx +0 -380
- package/src/components/post_view/combined_system_message/index.ts +0 -46
- package/src/components/post_view/combined_system_message/last_users.test.tsx +0 -56
- package/src/components/post_view/combined_system_message/last_users.tsx +0 -135
- package/src/components/post_view/combined_user_activity_post/index.ts +0 -28
- package/src/components/post_view/comment_icon/index.ts +0 -31
- package/src/components/post_view/commented_on/__snapshots__/commented_on.test.tsx.snap +0 -276
- package/src/components/post_view/commented_on/commented_on.test.tsx +0 -184
- package/src/components/post_view/commented_on/commented_on.tsx +0 -92
- package/src/components/post_view/commented_on/index.ts +0 -37
- package/src/components/post_view/commented_on_files_message/__snapshots__/commented_on_files_message.test.jsx.snap +0 -24
- package/src/components/post_view/commented_on_files_message/commented_on_files_message.jsx +0 -47
- package/src/components/post_view/commented_on_files_message/commented_on_files_message.test.jsx +0 -53
- package/src/components/post_view/commented_on_files_message/index.js +0 -25
- package/src/components/post_view/date_separator/__snapshots__/date_separator.test.tsx.snap +0 -35
- package/src/components/post_view/date_separator/date_separator.test.tsx +0 -26
- package/src/components/post_view/date_separator/date_separator.tsx +0 -40
- package/src/components/post_view/date_separator/index.ts +0 -4
- package/src/components/post_view/embedded_bindings/button_binding/__snapshots__/button_binding.test.tsx.snap +0 -23
- package/src/components/post_view/embedded_bindings/button_binding/button_binding.test.tsx +0 -124
- package/src/components/post_view/embedded_bindings/button_binding/button_binding.tsx +0 -141
- package/src/components/post_view/embedded_bindings/button_binding/index.ts +0 -34
- package/src/components/post_view/embedded_bindings/embedded_binding/__snapshots__/embedded_binding.test.tsx.snap +0 -249
- package/src/components/post_view/embedded_bindings/embedded_binding/embedded_binding.test.tsx +0 -76
- package/src/components/post_view/embedded_bindings/embedded_binding/embedded_binding.tsx +0 -205
- package/src/components/post_view/embedded_bindings/embedded_binding/index.ts +0 -17
- package/src/components/post_view/embedded_bindings/embedded_bindings.tsx +0 -59
- package/src/components/post_view/embedded_bindings/select_binding/index.ts +0 -33
- package/src/components/post_view/embedded_bindings/select_binding/select_binding.test.tsx +0 -170
- package/src/components/post_view/embedded_bindings/select_binding/select_binding.tsx +0 -188
- package/src/components/post_view/failed_post_options/__snapshots__/failed_post_options.test.tsx.snap +0 -29
- package/src/components/post_view/failed_post_options/failed_post_options.test.tsx +0 -59
- package/src/components/post_view/failed_post_options/failed_post_options.tsx +0 -67
- package/src/components/post_view/failed_post_options/index.ts +0 -23
- package/src/components/post_view/floating_timestamp/__snapshots__/floating_timestamp.test.tsx.snap +0 -41
- package/src/components/post_view/floating_timestamp/floating_timestamp.test.tsx +0 -23
- package/src/components/post_view/floating_timestamp/floating_timestamp.tsx +0 -52
- package/src/components/post_view/floating_timestamp/index.ts +0 -35
- package/src/components/post_view/index.js +0 -61
- package/src/components/post_view/index.test.js +0 -37
- package/src/components/post_view/message_attachments/action_button/__snapshots__/action_button.test.tsx.snap +0 -26
- package/src/components/post_view/message_attachments/action_button/action_button.test.tsx +0 -113
- package/src/components/post_view/message_attachments/action_button/action_button.tsx +0 -80
- package/src/components/post_view/message_attachments/action_button/index.ts +0 -17
- package/src/components/post_view/message_attachments/action_menu/action_menu.test.tsx +0 -61
- package/src/components/post_view/message_attachments/action_menu/action_menu.tsx +0 -156
- package/src/components/post_view/message_attachments/action_menu/index.ts +0 -41
- package/src/components/post_view/message_attachments/message_attachment/__snapshots__/message_attachment.test.tsx.snap +0 -726
- package/src/components/post_view/message_attachments/message_attachment/index.ts +0 -32
- package/src/components/post_view/message_attachments/message_attachment/message_attachment.test.tsx +0 -234
- package/src/components/post_view/message_attachments/message_attachment/message_attachment.tsx +0 -544
- package/src/components/post_view/message_attachments/message_attachment_list.tsx +0 -64
- package/src/components/post_view/new_message_separator/__snapshots__/new_message_separator.test.tsx.snap +0 -16
- package/src/components/post_view/new_message_separator/new_message_separator.test.tsx +0 -16
- package/src/components/post_view/new_message_separator/new_message_separator.tsx +0 -31
- package/src/components/post_view/post/__snapshots__/post.test.js.snap +0 -337
- package/src/components/post_view/post/index.test.js +0 -61
- package/src/components/post_view/post/index.ts +0 -96
- package/src/components/post_view/post/post.jsx +0 -446
- package/src/components/post_view/post/post.test.js +0 -222
- package/src/components/post_view/post_add_channel_member/__snapshots__/post_add_channel_member.test.tsx.snap +0 -226
- package/src/components/post_view/post_add_channel_member/index.ts +0 -47
- package/src/components/post_view/post_add_channel_member/post_add_channel_member.test.tsx +0 -140
- package/src/components/post_view/post_add_channel_member/post_add_channel_member.tsx +0 -231
- package/src/components/post_view/post_aria_label_div.test.jsx +0 -106
- package/src/components/post_view/post_aria_label_div.tsx +0 -48
- package/src/components/post_view/post_attachment_container/__snapshots__/post_attachment_container.test.tsx.snap +0 -25
- package/src/components/post_view/post_attachment_container/post_attachment_container.test.tsx +0 -21
- package/src/components/post_view/post_attachment_container/post_attachment_container.tsx +0 -40
- package/src/components/post_view/post_attachment_opengraph/get_nearest_point.test.ts +0 -55
- package/src/components/post_view/post_attachment_opengraph/get_nearest_point.ts +0 -31
- package/src/components/post_view/post_attachment_opengraph/index.ts +0 -48
- package/src/components/post_view/post_attachment_opengraph/post_attachment_opengraph.test.tsx +0 -264
- package/src/components/post_view/post_attachment_opengraph/post_attachment_opengraph.tsx +0 -262
- package/src/components/post_view/post_body/index.js +0 -36
- package/src/components/post_view/post_body/post_body.jsx +0 -235
- package/src/components/post_view/post_body_additional_content/__snapshots__/post_body_additional_content.test.tsx.snap +0 -295
- package/src/components/post_view/post_body_additional_content/index.ts +0 -36
- package/src/components/post_view/post_body_additional_content/post_body_additional_content.test.tsx +0 -425
- package/src/components/post_view/post_body_additional_content/post_body_additional_content.tsx +0 -194
- package/src/components/post_view/post_context.js +0 -14
- package/src/components/post_view/post_flag_icon/__snapshots__/post_flag_icon.test.js.snap +0 -81
- package/src/components/post_view/post_flag_icon/index.js +0 -20
- package/src/components/post_view/post_flag_icon/post_flag_icon.js +0 -125
- package/src/components/post_view/post_flag_icon/post_flag_icon.test.js +0 -39
- package/src/components/post_view/post_header/__snapshots__/post_header.test.tsx.snap +0 -196
- package/src/components/post_view/post_header/index.ts +0 -38
- package/src/components/post_view/post_header/post_header.scss +0 -53
- package/src/components/post_view/post_header/post_header.test.tsx +0 -68
- package/src/components/post_view/post_header/post_header.tsx +0 -202
- package/src/components/post_view/post_header/post_header_custom_status.tsx +0 -73
- package/src/components/post_view/post_image/index.js +0 -6
- package/src/components/post_view/post_image/post_image.jsx +0 -69
- package/src/components/post_view/post_info/__snapshots__/post_info.test.tsx.snap +0 -322
- package/src/components/post_view/post_info/index.ts +0 -66
- package/src/components/post_view/post_info/post_info.test.tsx +0 -170
- package/src/components/post_view/post_info/post_info.tsx +0 -403
- package/src/components/post_view/post_list/__snapshots__/post_list.test.jsx.snap +0 -71
- package/src/components/post_view/post_list/index.js +0 -105
- package/src/components/post_view/post_list/post_list.jsx +0 -324
- package/src/components/post_view/post_list/post_list.test.jsx +0 -274
- package/src/components/post_view/post_list_row/__snapshots__/post_list_row.test.tsx.snap +0 -108
- package/src/components/post_view/post_list_row/index.ts +0 -42
- package/src/components/post_view/post_list_row/post_list_row.test.tsx +0 -176
- package/src/components/post_view/post_list_row/post_list_row.tsx +0 -165
- package/src/components/post_view/post_list_virtualized/latest_post_reader.test.jsx +0 -80
- package/src/components/post_view/post_list_virtualized/latest_post_reader.tsx +0 -46
- package/src/components/post_view/post_list_virtualized/post_list_virtualized.jsx +0 -626
- package/src/components/post_view/post_list_virtualized/post_list_virtualized.test.jsx +0 -623
- package/src/components/post_view/post_message_preview/__snapshots__/post_message_preview.test.tsx.snap +0 -88
- package/src/components/post_view/post_message_preview/index.ts +0 -35
- package/src/components/post_view/post_message_preview/post_message_preview.test.tsx +0 -50
- package/src/components/post_view/post_message_preview/post_message_preview.tsx +0 -92
- package/src/components/post_view/post_message_view/__snapshots__/post_message_view.test.tsx.snap +0 -242
- package/src/components/post_view/post_message_view/index.ts +0 -27
- package/src/components/post_view/post_message_view/post_message_view.test.tsx +0 -89
- package/src/components/post_view/post_message_view/post_message_view.tsx +0 -192
- package/src/components/post_view/post_pre_header/__snapshots__/post_pre_header.test.tsx.snap +0 -209
- package/src/components/post_view/post_pre_header/index.js +0 -18
- package/src/components/post_view/post_pre_header/post_pre_header.test.tsx +0 -188
- package/src/components/post_view/post_pre_header/post_pre_header.tsx +0 -148
- package/src/components/post_view/post_reaction/__snapshots__/post_reaction.test.tsx.snap +0 -63
- package/src/components/post_view/post_reaction/index.ts +0 -21
- package/src/components/post_view/post_reaction/post_reaction.test.tsx +0 -39
- package/src/components/post_view/post_reaction/post_reaction.tsx +0 -124
- package/src/components/post_view/post_time/index.ts +0 -18
- package/src/components/post_view/post_time/post_time.tsx +0 -113
- package/src/components/post_view/post_view.jsx +0 -83
- package/src/components/post_view/post_view.test.js +0 -53
- package/src/components/post_view/reaction/__snapshots__/reaction.test.jsx.snap +0 -339
- package/src/components/post_view/reaction/index.ts +0 -120
- package/src/components/post_view/reaction/reaction.scss +0 -157
- package/src/components/post_view/reaction/reaction.test.jsx +0 -80
- package/src/components/post_view/reaction/reaction.tsx +0 -263
- package/src/components/post_view/reaction/reaction_tooltip/index.test.js +0 -56
- package/src/components/post_view/reaction/reaction_tooltip/index.ts +0 -67
- package/src/components/post_view/reaction/reaction_tooltip/reaction_tooltip.tsx +0 -140
- package/src/components/post_view/reaction_list/__snapshots__/reactions_list.test.jsx.snap +0 -95
- package/src/components/post_view/reaction_list/index.ts +0 -52
- package/src/components/post_view/reaction_list/reaction_list.tsx +0 -201
- package/src/components/post_view/reaction_list/reactions_list.test.jsx +0 -57
- package/src/components/post_view/scroll_to_bottom_arrows.jsx +0 -37
- package/src/components/post_view/show_more/__snapshots__/show_more.test.tsx.snap +0 -237
- package/src/components/post_view/show_more/index.ts +0 -23
- package/src/components/post_view/show_more/show_more.test.tsx +0 -102
- package/src/components/post_view/show_more/show_more.tsx +0 -196
- package/src/components/status_icon.tsx +0 -49
- package/src/components/status_icon_new.tsx +0 -35
- package/src/compute.ts +0 -74
- package/src/containers/Dashboard.tsx +0 -527
- package/src/containers/DashboardWithLoader.tsx +0 -38
- package/src/containers/Inbox.tsx +0 -13
- package/src/containers/Loading.tsx +0 -12
- package/src/containers/Messenger.tsx +0 -18
- package/src/containers/__tests__/ApolloProvider.test.tsx +0 -48
- package/src/containers/__tests__/Counter.test.tsx +0 -49
- package/src/containers/__tests__/PersonList.test.tsx +0 -43
- package/src/containers/__tests__/__snapshots__/Counter.test.tsx.snap +0 -299
- package/src/containers/__tests__/__snapshots__/PersonList.test.tsx.snap +0 -230
- package/src/containers/__tests__/redux.test.tsx +0 -86
- package/src/containers/__tests__/setup.ts +0 -18
- package/src/containers/__tests__/utils.ts +0 -5
- package/src/containers/index.ts +0 -4
- package/src/index.ts +0 -5
- package/src/inversify-containers/index.ts +0 -1
- package/src/inversify-containers/module.ts +0 -4
- package/src/module.ts +0 -21
- package/src/packages/constants/constants.ts +0 -1831
- package/src/packages/types/channels.ts +0 -194
- package/src/packages/types/emojis.ts +0 -41
- package/src/packages/types/files.ts +0 -43
- package/src/packages/types/posts.ts +0 -155
- package/src/packages/types/reactions.ts +0 -8
- package/src/packages/types/teams.ts +0 -105
- package/src/packages/types/utilities.ts +0 -30
- package/src/services/index.ts +0 -0
- package/src/style.ts +0 -401
- package/src/utils/constants.tsx +0 -1120
- package/src/utils/i18n.tsx +0 -15
- package/src/utils/index.ts +0 -34
- package/src/utils/post_list.ts +0 -54
- package/src/utils/post_utils.ts +0 -33
- package/src/utils/user_agent.tsx +0 -153
- package/src/utils/utils.tsx +0 -54
- package/src/widgets/badges/badge.scss +0 -21
- package/src/widgets/badges/badge.tsx +0 -30
- package/src/widgets/badges/bot_badge.tsx +0 -31
- package/src/widgets/badges/guest_badge.tsx +0 -31
- package/src/widgets/badges/style.ts +0 -24
- package/src/widgets/icons/accordion_toggle_icon.tsx +0 -59
- package/src/widgets/icons/add_reaction_icon.tsx +0 -23
- package/src/widgets/icons/admin_eye_icon.tsx +0 -30
- package/src/widgets/icons/alert_icon.tsx +0 -22
- package/src/widgets/icons/archive_icon.tsx +0 -23
- package/src/widgets/icons/arrow_right_icon.tsx +0 -23
- package/src/widgets/icons/at_icon.tsx +0 -22
- package/src/widgets/icons/attachment_icon.tsx +0 -38
- package/src/widgets/icons/back_icon.tsx +0 -22
- package/src/widgets/icons/bot_icon.tsx +0 -23
- package/src/widgets/icons/camera_icon.tsx +0 -41
- package/src/widgets/icons/checkbox_checked_icon.tsx +0 -62
- package/src/widgets/icons/checkbox_partial_icon.tsx +0 -62
- package/src/widgets/icons/close_circle_icon.tsx +0 -25
- package/src/widgets/icons/close_circle_solid_icon.tsx +0 -25
- package/src/widgets/icons/close_icon.tsx +0 -27
- package/src/widgets/icons/dots_horizontal.tsx +0 -22
- package/src/widgets/icons/download_icon.tsx +0 -46
- package/src/widgets/icons/draft_icon.tsx +0 -32
- package/src/widgets/icons/ellipsis_h_icon.tsx +0 -23
- package/src/widgets/icons/email_icon.tsx +0 -23
- package/src/widgets/icons/emoji_icon.tsx +0 -22
- package/src/widgets/icons/fa_add_icon.tsx +0 -15
- package/src/widgets/icons/fa_back_icon.tsx +0 -16
- package/src/widgets/icons/fa_dropdown_icon.tsx +0 -15
- package/src/widgets/icons/fa_edit_icon.tsx +0 -16
- package/src/widgets/icons/fa_logout_icon.tsx +0 -15
- package/src/widgets/icons/fa_next_icon.tsx +0 -28
- package/src/widgets/icons/fa_previous_icon.tsx +0 -28
- package/src/widgets/icons/fa_reload_icon.tsx +0 -16
- package/src/widgets/icons/fa_remove_icon.tsx +0 -16
- package/src/widgets/icons/fa_search_icon.tsx +0 -16
- package/src/widgets/icons/fa_select_icon.tsx +0 -16
- package/src/widgets/icons/fa_success_icon.tsx +0 -16
- package/src/widgets/icons/fa_warning_icon.tsx +0 -28
- package/src/widgets/icons/flag_icon.tsx +0 -22
- package/src/widgets/icons/flag_icon_filled.tsx +0 -41
- package/src/widgets/icons/gfycat_icon.tsx +0 -38
- package/src/widgets/icons/gif_reactions_icon.tsx +0 -52
- package/src/widgets/icons/gif_search_clear_icon.tsx +0 -27
- package/src/widgets/icons/gif_search_icon.tsx +0 -29
- package/src/widgets/icons/gif_trending_icon.tsx +0 -49
- package/src/widgets/icons/globe_icon.tsx +0 -22
- package/src/widgets/icons/icons.stories.js +0 -110
- package/src/widgets/icons/info_icon.tsx +0 -40
- package/src/widgets/icons/info_small_icon.tsx +0 -35
- package/src/widgets/icons/invite_icon.tsx +0 -22
- package/src/widgets/icons/invite_members_icon.tsx +0 -22
- package/src/widgets/icons/leave_team_icon.tsx +0 -30
- package/src/widgets/icons/link_icon.tsx +0 -23
- package/src/widgets/icons/lock_icon.tsx +0 -41
- package/src/widgets/icons/mail_icon.tsx +0 -22
- package/src/widgets/icons/mail_plus_icon.tsx +0 -22
- package/src/widgets/icons/mattermost_logo.tsx +0 -40
- package/src/widgets/icons/member_icon.tsx +0 -22
- package/src/widgets/icons/mentions_icon.tsx +0 -24
- package/src/widgets/icons/menu_icon.tsx +0 -42
- package/src/widgets/icons/message_icon.tsx +0 -42
- package/src/widgets/icons/pin_icon.tsx +0 -23
- package/src/widgets/icons/plugin_channel_header_icon.tsx +0 -23
- package/src/widgets/icons/plugin_icon.tsx +0 -44
- package/src/widgets/icons/reply_icon.tsx +0 -23
- package/src/widgets/icons/scroll_to_bottom_icon.tsx +0 -23
- package/src/widgets/icons/search_icon.tsx +0 -22
- package/src/widgets/icons/shield_outline_icon.tsx +0 -23
- package/src/widgets/icons/status_away_avatar_icon.tsx +0 -33
- package/src/widgets/icons/status_away_icon.tsx +0 -33
- package/src/widgets/icons/status_dnd_avatar_icon.tsx +0 -41
- package/src/widgets/icons/status_dnd_icon.tsx +0 -33
- package/src/widgets/icons/status_offline_avatar_icon.tsx +0 -45
- package/src/widgets/icons/status_offline_icon.tsx +0 -31
- package/src/widgets/icons/status_online_avatar_icon.tsx +0 -49
- package/src/widgets/icons/status_online_icon.tsx +0 -33
- package/src/widgets/icons/team_info_icon.tsx +0 -32
- package/src/widgets/icons/unarchive_icon.tsx +0 -22
- package/src/widgets/icons/unread_below_icon.tsx +0 -23
- package/src/widgets/icons/user_guide_icon.tsx +0 -26
- package/src/widgets/overlay_trigger.tsx +0 -59
- package/src/widgets/shared_user_indicator.tsx +0 -37
- package/src/widgets/simple_tooltip/index.ts +0 -7
- package/src/widgets/simple_tooltip/simple_tooltip.tsx +0 -63
- package/src/widgets/users/avatar/avatar.test.tsx +0 -34
- package/src/widgets/users/avatar/avatar.tsx +0 -38
- package/src/widgets/users/avatar/index.ts +0 -4
- package/src/widgets/users/avatar/style.ts +0 -79
- package/src/widgets/users/avatars/__snapshots__/avatars.test.tsx.snap +0 -1585
- package/src/widgets/users/avatars/avatars.scss +0 -64
- package/src/widgets/users/avatars/avatars.test.tsx +0 -184
- package/src/widgets/users/avatars/avatars.tsx +0 -146
- package/src/widgets/users/avatars/index.ts +0 -4
- package/src/widgets/users/users.stories.tsx +0 -37
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -58
|
@@ -1,1335 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
|
|
6
|
-
import CreatePost from 'components/create_post/create_post';
|
|
7
|
-
|
|
8
|
-
import {Posts} from 'mattermost-redux/constants';
|
|
9
|
-
|
|
10
|
-
import {shallowWithIntl} from 'tests/helpers/intl-test-helper';
|
|
11
|
-
import {testComponentForLineBreak} from 'tests/helpers/line_break_helpers';
|
|
12
|
-
import {testComponentForMarkdownHotkeys, makeSelectionEvent} from 'tests/helpers/markdown_hotkey_helpers.js';
|
|
13
|
-
import * as GlobalActions from 'actions/global_actions';
|
|
14
|
-
import EmojiMap from 'utils/emoji_map';
|
|
15
|
-
|
|
16
|
-
import Constants, {StoragePrefixes, ModalIdentifiers} from 'utils/constants';
|
|
17
|
-
import * as Utils from 'utils/utils.jsx';
|
|
18
|
-
|
|
19
|
-
import FileUpload from 'components/file_upload';
|
|
20
|
-
import Textbox from 'components/textbox';
|
|
21
|
-
|
|
22
|
-
jest.mock('actions/global_actions', () => ({
|
|
23
|
-
emitLocalUserTypingEvent: jest.fn(),
|
|
24
|
-
emitUserPostedEvent: jest.fn(),
|
|
25
|
-
showChannelNameUpdateModal: jest.fn(),
|
|
26
|
-
toggleShortcutsModal: jest.fn(),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
jest.mock('actions/post_actions.jsx', () => ({
|
|
30
|
-
createPost: jest.fn(() => {
|
|
31
|
-
return new Promise((resolve) => {
|
|
32
|
-
process.nextTick(() => resolve());
|
|
33
|
-
});
|
|
34
|
-
}),
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
const currentTeamIdProp = 'r7rws4y7ppgszym3pdd5kaibfa';
|
|
38
|
-
const currentUserIdProp = 'zaktnt8bpbgu8mb6ez9k64r7sa';
|
|
39
|
-
const showTutorialTipProp = false;
|
|
40
|
-
const fullWidthTextBoxProp = true;
|
|
41
|
-
const recentPostIdInChannelProp = 'a';
|
|
42
|
-
const latestReplyablePostIdProp = 'a';
|
|
43
|
-
const localeProp = 'en';
|
|
44
|
-
|
|
45
|
-
const currentChannelProp = {
|
|
46
|
-
id: 'owsyt8n43jfxjpzh9np93mx1wa',
|
|
47
|
-
type: 'O',
|
|
48
|
-
};
|
|
49
|
-
const currentChannelMembersCountProp = 9;
|
|
50
|
-
const draftProp = {
|
|
51
|
-
message: '',
|
|
52
|
-
uploadsInProgress: [],
|
|
53
|
-
fileInfos: [],
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const ctrlSendProp = false;
|
|
57
|
-
|
|
58
|
-
const currentUsersLatestPostProp = {id: 'b', root_id: 'a', channel_id: currentChannelProp.id};
|
|
59
|
-
|
|
60
|
-
const actionsProp = {
|
|
61
|
-
addMessageIntoHistory: jest.fn(),
|
|
62
|
-
moveHistoryIndexBack: jest.fn(),
|
|
63
|
-
moveHistoryIndexForward: jest.fn(),
|
|
64
|
-
addReaction: jest.fn(),
|
|
65
|
-
removeReaction: jest.fn(),
|
|
66
|
-
clearDraftUploads: jest.fn(),
|
|
67
|
-
onSubmitPost: jest.fn(),
|
|
68
|
-
selectPostFromRightHandSideSearchByPostId: jest.fn(),
|
|
69
|
-
setDraft: jest.fn(),
|
|
70
|
-
setEditingPost: jest.fn(),
|
|
71
|
-
openModal: jest.fn(),
|
|
72
|
-
setShowPreview: jest.fn(),
|
|
73
|
-
executeCommand: async () => {
|
|
74
|
-
return {data: true};
|
|
75
|
-
},
|
|
76
|
-
getChannelTimezones: jest.fn(),
|
|
77
|
-
runMessageWillBePostedHooks: async (post) => {
|
|
78
|
-
return {data: post};
|
|
79
|
-
},
|
|
80
|
-
runSlashCommandWillBePostedHooks: async (message, args) => {
|
|
81
|
-
return {data: {message, args}};
|
|
82
|
-
},
|
|
83
|
-
scrollPostListToBottom: jest.fn(),
|
|
84
|
-
getChannelMemberCountsByGroup: jest.fn(),
|
|
85
|
-
emitShortcutReactToLastPostFrom: jest.fn(),
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/* eslint-disable react/prop-types */
|
|
89
|
-
function createPost({
|
|
90
|
-
currentChannel = currentChannelProp,
|
|
91
|
-
currentTeamId = currentTeamIdProp,
|
|
92
|
-
currentUserId = currentUserIdProp,
|
|
93
|
-
showTutorialTip = showTutorialTipProp,
|
|
94
|
-
currentChannelMembersCount = currentChannelMembersCountProp,
|
|
95
|
-
fullWidthTextBox = fullWidthTextBoxProp,
|
|
96
|
-
draft = draftProp,
|
|
97
|
-
recentPostIdInChannel = recentPostIdInChannelProp,
|
|
98
|
-
latestReplyablePostId = latestReplyablePostIdProp,
|
|
99
|
-
locale = localeProp,
|
|
100
|
-
actions = actionsProp,
|
|
101
|
-
ctrlSend = ctrlSendProp,
|
|
102
|
-
currentUsersLatestPost = currentUsersLatestPostProp,
|
|
103
|
-
readOnlyChannel = false,
|
|
104
|
-
canUploadFiles = true,
|
|
105
|
-
emojiMap = new EmojiMap(new Map()),
|
|
106
|
-
isTimezoneEnabled = false,
|
|
107
|
-
useGroupMentions = true,
|
|
108
|
-
} = {}) {
|
|
109
|
-
return (
|
|
110
|
-
<CreatePost
|
|
111
|
-
currentChannel={currentChannel}
|
|
112
|
-
currentTeamId={currentTeamId}
|
|
113
|
-
currentUserId={currentUserId}
|
|
114
|
-
showTutorialTip={showTutorialTip}
|
|
115
|
-
fullWidthTextBox={fullWidthTextBox}
|
|
116
|
-
currentChannelMembersCount={currentChannelMembersCount}
|
|
117
|
-
draft={draft}
|
|
118
|
-
recentPostIdInChannel={recentPostIdInChannel}
|
|
119
|
-
latestReplyablePostId={latestReplyablePostId}
|
|
120
|
-
locale={locale}
|
|
121
|
-
ctrlSend={ctrlSend}
|
|
122
|
-
currentUsersLatestPost={currentUsersLatestPost}
|
|
123
|
-
actions={actions}
|
|
124
|
-
readOnlyChannel={readOnlyChannel}
|
|
125
|
-
canUploadFiles={canUploadFiles}
|
|
126
|
-
enableTutorial={true}
|
|
127
|
-
enableConfirmNotificationsToChannel={true}
|
|
128
|
-
enableEmojiPicker={true}
|
|
129
|
-
enableGifPicker={true}
|
|
130
|
-
maxPostSize={Constants.DEFAULT_CHARACTER_LIMIT}
|
|
131
|
-
userIsOutOfOffice={false}
|
|
132
|
-
rhsExpanded={false}
|
|
133
|
-
emojiMap={emojiMap}
|
|
134
|
-
badConnection={false}
|
|
135
|
-
shouldShowPreview={false}
|
|
136
|
-
isTimezoneEnabled={isTimezoneEnabled}
|
|
137
|
-
canPost={true}
|
|
138
|
-
useChannelMentions={true}
|
|
139
|
-
useGroupMentions={useGroupMentions}
|
|
140
|
-
/>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
/* eslint-enable react/prop-types */
|
|
144
|
-
|
|
145
|
-
describe('components/create_post', () => {
|
|
146
|
-
jest.useFakeTimers('legacy');
|
|
147
|
-
|
|
148
|
-
beforeEach(() => {
|
|
149
|
-
jest.spyOn(window, 'requestAnimationFrame').mockImplementation((cb) => setTimeout(cb, 16));
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
afterEach(() => {
|
|
153
|
-
window.requestAnimationFrame.mockRestore();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('should match snapshot, init', () => {
|
|
157
|
-
const wrapper = shallowWithIntl(createPost({}));
|
|
158
|
-
|
|
159
|
-
expect(wrapper).toMatchSnapshot();
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('should match snapshot for center textbox', () => {
|
|
163
|
-
const wrapper = shallowWithIntl(createPost({fullWidthTextBox: false}));
|
|
164
|
-
|
|
165
|
-
expect(wrapper.find('#create_post').hasClass('center')).toBe(true);
|
|
166
|
-
expect(wrapper).toMatchSnapshot();
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it('should call clearDraftUploads on mount', () => {
|
|
170
|
-
const clearDraftUploads = jest.fn();
|
|
171
|
-
const actions = {
|
|
172
|
-
...actionsProp,
|
|
173
|
-
clearDraftUploads,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
shallowWithIntl(createPost({actions}));
|
|
177
|
-
|
|
178
|
-
expect(clearDraftUploads).toHaveBeenCalled();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('Check for state change on channelId change with useGroupMentions = true', () => {
|
|
182
|
-
const wrapper = shallowWithIntl(createPost({}));
|
|
183
|
-
const draft = {
|
|
184
|
-
...draftProp,
|
|
185
|
-
message: 'test',
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
expect(wrapper.state('message')).toBe('');
|
|
189
|
-
|
|
190
|
-
wrapper.setProps({draft});
|
|
191
|
-
expect(wrapper.state('message')).toBe('');
|
|
192
|
-
|
|
193
|
-
wrapper.setProps({
|
|
194
|
-
currentChannel: {
|
|
195
|
-
...currentChannelProp,
|
|
196
|
-
id: 'owsyt8n43jfxjpzh9np93mx1wb',
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
expect(wrapper.state('message')).toBe('test');
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('Check for getChannelMemberCountsByGroup called on mount and when channel changed with useGroupMentions = true', () => {
|
|
203
|
-
const getChannelMemberCountsByGroup = jest.fn();
|
|
204
|
-
const actions = {
|
|
205
|
-
...actionsProp,
|
|
206
|
-
getChannelMemberCountsByGroup,
|
|
207
|
-
};
|
|
208
|
-
const wrapper = shallowWithIntl(createPost({actions}));
|
|
209
|
-
expect(getChannelMemberCountsByGroup).toHaveBeenCalled();
|
|
210
|
-
wrapper.setProps({
|
|
211
|
-
currentChannel: {
|
|
212
|
-
...currentChannelProp,
|
|
213
|
-
id: 'owsyt8n43jfxjpzh9np93mx1wb',
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
expect(getChannelMemberCountsByGroup).toHaveBeenCalled();
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('Check for getChannelMemberCountsByGroup not called on mount and when channel changed with useGroupMentions = false', () => {
|
|
220
|
-
const getChannelMemberCountsByGroup = jest.fn();
|
|
221
|
-
const useGroupMentions = false;
|
|
222
|
-
const actions = {
|
|
223
|
-
...actionsProp,
|
|
224
|
-
getChannelMemberCountsByGroup,
|
|
225
|
-
};
|
|
226
|
-
const wrapper = shallowWithIntl(createPost({actions, useGroupMentions}));
|
|
227
|
-
expect(getChannelMemberCountsByGroup).not.toHaveBeenCalled();
|
|
228
|
-
wrapper.setProps({
|
|
229
|
-
currentChannel: {
|
|
230
|
-
...currentChannelProp,
|
|
231
|
-
id: 'owsyt8n43jfxjpzh9np93mx1wb',
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
expect(getChannelMemberCountsByGroup).not.toHaveBeenCalled();
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('click toggleEmojiPicker', () => {
|
|
238
|
-
const wrapper = shallowWithIntl(createPost());
|
|
239
|
-
wrapper.find('.emoji-picker__container').simulate('click');
|
|
240
|
-
expect(wrapper.state('showEmojiPicker')).toBe(true);
|
|
241
|
-
wrapper.find('.emoji-picker__container').simulate('click');
|
|
242
|
-
wrapper.find('EmojiPickerOverlay').prop('onHide')();
|
|
243
|
-
expect(wrapper.state('showEmojiPicker')).toBe(false);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('Check for emoji click message states', () => {
|
|
247
|
-
const wrapper = shallowWithIntl(createPost());
|
|
248
|
-
const mockImpl = () => {
|
|
249
|
-
return {
|
|
250
|
-
setSelectionRange: jest.fn(),
|
|
251
|
-
focus: jest.fn(),
|
|
252
|
-
};
|
|
253
|
-
};
|
|
254
|
-
wrapper.instance().textboxRef.current = {getInputBox: jest.fn(mockImpl), focus: jest.fn(), blur: jest.fn()};
|
|
255
|
-
|
|
256
|
-
wrapper.find('.emoji-picker__container').simulate('click');
|
|
257
|
-
expect(wrapper.state('showEmojiPicker')).toBe(true);
|
|
258
|
-
|
|
259
|
-
wrapper.instance().handleEmojiClick({name: 'smile'});
|
|
260
|
-
expect(wrapper.state('message')).toBe(':smile: ');
|
|
261
|
-
|
|
262
|
-
wrapper.setState({
|
|
263
|
-
message: 'test',
|
|
264
|
-
caretPosition: 'test'.length, // cursor is at the end
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
wrapper.instance().handleEmojiClick({name: 'smile'});
|
|
268
|
-
expect(wrapper.state('message')).toBe('test :smile: ');
|
|
269
|
-
|
|
270
|
-
wrapper.setState({
|
|
271
|
-
message: 'test ',
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
wrapper.instance().handleEmojiClick({name: 'smile'});
|
|
275
|
-
expect(wrapper.state('message')).toBe('test :smile: ');
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it('onChange textbox should call setDraft and change message state', () => {
|
|
279
|
-
const setDraft = jest.fn();
|
|
280
|
-
const draft = {
|
|
281
|
-
...draftProp,
|
|
282
|
-
message: 'change',
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const wrapper = shallowWithIntl(
|
|
286
|
-
createPost({
|
|
287
|
-
actions: {
|
|
288
|
-
...actionsProp,
|
|
289
|
-
setDraft,
|
|
290
|
-
},
|
|
291
|
-
}),
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
const postTextbox = wrapper.find('#post_textbox');
|
|
295
|
-
postTextbox.simulate('change', {target: {value: 'change'}});
|
|
296
|
-
expect(setDraft).not.toHaveBeenCalled();
|
|
297
|
-
jest.runOnlyPendingTimers();
|
|
298
|
-
expect(setDraft).toHaveBeenCalledWith(StoragePrefixes.DRAFT + currentChannelProp.id, draft);
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it('onKeyPress textbox should call emitLocalUserTypingEvent', () => {
|
|
302
|
-
const wrapper = shallowWithIntl(createPost());
|
|
303
|
-
wrapper.instance().textboxRef.current = {blur: jest.fn()};
|
|
304
|
-
|
|
305
|
-
const postTextbox = wrapper.find('#post_textbox');
|
|
306
|
-
postTextbox.simulate('KeyPress', {key: Constants.KeyCodes.ENTER[0], preventDefault: jest.fn(), persist: jest.fn()});
|
|
307
|
-
expect(GlobalActions.emitLocalUserTypingEvent).toHaveBeenCalledWith(currentChannelProp.id, '');
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
it('onSubmit test for @all', () => {
|
|
311
|
-
const wrapper = shallowWithIntl(createPost());
|
|
312
|
-
|
|
313
|
-
wrapper.setState({
|
|
314
|
-
message: 'test @all',
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
const form = wrapper.find('#create_post');
|
|
318
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
319
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
320
|
-
wrapper.instance().hideNotifyAllModal();
|
|
321
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
322
|
-
|
|
323
|
-
wrapper.setProps({
|
|
324
|
-
currentChannelMembersCount: 2,
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
328
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('onSubmit test for @groups', () => {
|
|
332
|
-
const wrapper = shallowWithIntl(createPost());
|
|
333
|
-
|
|
334
|
-
wrapper.setProps({
|
|
335
|
-
groupsWithAllowReference: new Map([
|
|
336
|
-
['@developers', {
|
|
337
|
-
id: 'developers',
|
|
338
|
-
name: 'developers',
|
|
339
|
-
}],
|
|
340
|
-
]),
|
|
341
|
-
channelMemberCountsByGroup: {
|
|
342
|
-
developers: {
|
|
343
|
-
channel_member_count: 10,
|
|
344
|
-
channel_member_timezones_count: 0,
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
wrapper.setState({
|
|
349
|
-
message: '@developers',
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
const form = wrapper.find('#create_post');
|
|
353
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
354
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
355
|
-
expect(wrapper.state('memberNotifyCount')).toBe(10);
|
|
356
|
-
expect(wrapper.state('channelTimezoneCount')).toBe(0);
|
|
357
|
-
expect(wrapper.state('mentions')).toMatchObject(['@developers']);
|
|
358
|
-
wrapper.instance().hideNotifyAllModal();
|
|
359
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
it('onSubmit test for several @groups', () => {
|
|
363
|
-
const wrapper = shallowWithIntl(createPost());
|
|
364
|
-
|
|
365
|
-
wrapper.setProps({
|
|
366
|
-
groupsWithAllowReference: new Map([
|
|
367
|
-
['@developers', {
|
|
368
|
-
id: 'developers',
|
|
369
|
-
name: 'developers',
|
|
370
|
-
}],
|
|
371
|
-
['@boss', {
|
|
372
|
-
id: 'boss',
|
|
373
|
-
name: 'boss',
|
|
374
|
-
}],
|
|
375
|
-
['@love', {
|
|
376
|
-
id: 'love',
|
|
377
|
-
name: 'love',
|
|
378
|
-
}],
|
|
379
|
-
['@you', {
|
|
380
|
-
id: 'you',
|
|
381
|
-
name: 'you',
|
|
382
|
-
}],
|
|
383
|
-
['@software-developers', {
|
|
384
|
-
id: 'softwareDevelopers',
|
|
385
|
-
name: 'software-developers',
|
|
386
|
-
}],
|
|
387
|
-
]),
|
|
388
|
-
channelMemberCountsByGroup: {
|
|
389
|
-
developers: {
|
|
390
|
-
channel_member_count: 10,
|
|
391
|
-
channel_member_timezones_count: 0,
|
|
392
|
-
},
|
|
393
|
-
boss: {
|
|
394
|
-
channel_member_count: 20,
|
|
395
|
-
channel_member_timezones_count: 0,
|
|
396
|
-
},
|
|
397
|
-
love: {
|
|
398
|
-
channel_member_count: 30,
|
|
399
|
-
channel_member_timezones_count: 0,
|
|
400
|
-
},
|
|
401
|
-
you: {
|
|
402
|
-
channel_member_count: 40,
|
|
403
|
-
channel_member_timezones_count: 0,
|
|
404
|
-
},
|
|
405
|
-
softwareDevelopers: {
|
|
406
|
-
channel_member_count: 5,
|
|
407
|
-
channel_member_timezones_count: 0,
|
|
408
|
-
},
|
|
409
|
-
},
|
|
410
|
-
});
|
|
411
|
-
wrapper.setState({
|
|
412
|
-
message: '@developers @boss @love @you @software-developers',
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
const form = wrapper.find('#create_post');
|
|
416
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
417
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
418
|
-
expect(wrapper.state('memberNotifyCount')).toBe(40);
|
|
419
|
-
expect(wrapper.state('channelTimezoneCount')).toBe(0);
|
|
420
|
-
expect(wrapper.state('mentions')).toMatchObject(['@developers', '@boss', '@love', '@you', '@software-developers']);
|
|
421
|
-
wrapper.instance().hideNotifyAllModal();
|
|
422
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
it('onSubmit test for several @groups with timezone', () => {
|
|
426
|
-
const wrapper = shallowWithIntl(createPost());
|
|
427
|
-
|
|
428
|
-
wrapper.setProps({
|
|
429
|
-
groupsWithAllowReference: new Map([
|
|
430
|
-
['@developers', {
|
|
431
|
-
id: 'developers',
|
|
432
|
-
name: 'developers',
|
|
433
|
-
}],
|
|
434
|
-
['@boss', {
|
|
435
|
-
id: 'boss',
|
|
436
|
-
name: 'boss',
|
|
437
|
-
}],
|
|
438
|
-
['@love', {
|
|
439
|
-
id: 'love',
|
|
440
|
-
name: 'love',
|
|
441
|
-
}],
|
|
442
|
-
['@you', {
|
|
443
|
-
id: 'you',
|
|
444
|
-
name: 'you',
|
|
445
|
-
}],
|
|
446
|
-
]),
|
|
447
|
-
channelMemberCountsByGroup: {
|
|
448
|
-
developers: {
|
|
449
|
-
channel_member_count: 10,
|
|
450
|
-
channel_member_timezones_count: 10,
|
|
451
|
-
},
|
|
452
|
-
boss: {
|
|
453
|
-
channel_member_count: 20,
|
|
454
|
-
channel_member_timezones_count: 130,
|
|
455
|
-
},
|
|
456
|
-
love: {
|
|
457
|
-
channel_member_count: 30,
|
|
458
|
-
channel_member_timezones_count: 2,
|
|
459
|
-
},
|
|
460
|
-
you: {
|
|
461
|
-
channel_member_count: 40,
|
|
462
|
-
channel_member_timezones_count: 5,
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
wrapper.setState({
|
|
467
|
-
message: '@developers @boss @love @you',
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
const form = wrapper.find('#create_post');
|
|
471
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
472
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
473
|
-
expect(wrapper.state('memberNotifyCount')).toBe(40);
|
|
474
|
-
expect(wrapper.state('channelTimezoneCount')).toBe(5);
|
|
475
|
-
expect(wrapper.state('mentions')).toMatchObject(['@developers', '@boss', '@love', '@you']);
|
|
476
|
-
wrapper.instance().hideNotifyAllModal();
|
|
477
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
478
|
-
});
|
|
479
|
-
|
|
480
|
-
it('Should set mentionHighlightDisabled prop when useChannelMentions disabled before calling actions.onSubmitPost', async () => {
|
|
481
|
-
const onSubmitPost = jest.fn();
|
|
482
|
-
const wrapper = shallowWithIntl(createPost({
|
|
483
|
-
actions: {
|
|
484
|
-
...actionsProp,
|
|
485
|
-
onSubmitPost,
|
|
486
|
-
},
|
|
487
|
-
}));
|
|
488
|
-
|
|
489
|
-
wrapper.setProps({
|
|
490
|
-
useChannelMentions: false,
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
const post = {message: 'message with @here mention'};
|
|
494
|
-
await wrapper.instance().sendMessage(post);
|
|
495
|
-
|
|
496
|
-
expect(onSubmitPost).toHaveBeenCalledTimes(1);
|
|
497
|
-
expect(onSubmitPost.mock.calls[0][0]).toEqual({...post, props: {mentionHighlightDisabled: true}});
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
it('Should not set mentionHighlightDisabled prop when useChannelMentions enabled before calling actions.onSubmitPost', async () => {
|
|
501
|
-
const onSubmitPost = jest.fn();
|
|
502
|
-
const wrapper = shallowWithIntl(createPost({
|
|
503
|
-
actions: {
|
|
504
|
-
...actionsProp,
|
|
505
|
-
onSubmitPost,
|
|
506
|
-
},
|
|
507
|
-
}));
|
|
508
|
-
|
|
509
|
-
wrapper.setProps({
|
|
510
|
-
useChannelMentions: true,
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
const post = {message: 'message with @here mention'};
|
|
514
|
-
await wrapper.instance().sendMessage(post);
|
|
515
|
-
|
|
516
|
-
expect(onSubmitPost).toHaveBeenCalledTimes(1);
|
|
517
|
-
expect(onSubmitPost.mock.calls[0][0]).toEqual(post);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
it('Should not set mentionHighlightDisabled prop when useChannelMentions disabled but message does not contain channel metion before calling actions.onSubmitPost', async () => {
|
|
521
|
-
const onSubmitPost = jest.fn();
|
|
522
|
-
const wrapper = shallowWithIntl(createPost({
|
|
523
|
-
actions: {
|
|
524
|
-
...actionsProp,
|
|
525
|
-
onSubmitPost,
|
|
526
|
-
},
|
|
527
|
-
}));
|
|
528
|
-
|
|
529
|
-
wrapper.setProps({
|
|
530
|
-
useChannelMentions: false,
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
const post = {message: 'message without mention'};
|
|
534
|
-
await wrapper.instance().sendMessage(post);
|
|
535
|
-
|
|
536
|
-
expect(onSubmitPost).toHaveBeenCalledTimes(1);
|
|
537
|
-
expect(onSubmitPost.mock.calls[0][0]).toEqual(post);
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
it('onSubmit test for @all with timezones', () => {
|
|
541
|
-
const wrapper = shallowWithIntl(
|
|
542
|
-
createPost({
|
|
543
|
-
actions: {
|
|
544
|
-
...actionsProp,
|
|
545
|
-
getChannelTimezones: jest.fn(() => Promise.resolve({data: [1, 2, 3, 4]})),
|
|
546
|
-
},
|
|
547
|
-
isTimezoneEnabled: true,
|
|
548
|
-
currentChannelMembersCount: 9,
|
|
549
|
-
}),
|
|
550
|
-
);
|
|
551
|
-
|
|
552
|
-
wrapper.setState({
|
|
553
|
-
message: 'test @all',
|
|
554
|
-
channelTimezoneCount: 4,
|
|
555
|
-
showConfirmModal: true,
|
|
556
|
-
memberNotifyCount: 8,
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
const form = wrapper.find('#create_post');
|
|
560
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
561
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
562
|
-
expect(wrapper.state('channelTimezoneCount')).toBe(4);
|
|
563
|
-
expect(wrapper.state('memberNotifyCount')).toBe(8);
|
|
564
|
-
wrapper.instance().hideNotifyAllModal();
|
|
565
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
566
|
-
|
|
567
|
-
wrapper.setProps({
|
|
568
|
-
currentChannelMembersCount: 2,
|
|
569
|
-
});
|
|
570
|
-
|
|
571
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
572
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
it('onSubmit test for @all with timezones disabled', () => {
|
|
576
|
-
const wrapper = shallowWithIntl(
|
|
577
|
-
createPost({
|
|
578
|
-
getChannelTimezones: jest.fn(() => Promise.resolve([])),
|
|
579
|
-
isTimezoneEnabled: false,
|
|
580
|
-
}),
|
|
581
|
-
);
|
|
582
|
-
|
|
583
|
-
wrapper.setState({
|
|
584
|
-
message: 'test @all',
|
|
585
|
-
});
|
|
586
|
-
|
|
587
|
-
const form = wrapper.find('#create_post');
|
|
588
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
589
|
-
expect(wrapper.state('showConfirmModal')).toBe(true);
|
|
590
|
-
expect(wrapper.state('channelTimezoneCount')).toBe(0);
|
|
591
|
-
wrapper.instance().hideNotifyAllModal();
|
|
592
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
593
|
-
|
|
594
|
-
wrapper.setProps({
|
|
595
|
-
currentChannelMembersCount: 2,
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
599
|
-
expect(wrapper.state('showConfirmModal')).toBe(false);
|
|
600
|
-
});
|
|
601
|
-
|
|
602
|
-
it('onSubmit test for "/header" message', () => {
|
|
603
|
-
const openModal = jest.fn();
|
|
604
|
-
|
|
605
|
-
const wrapper = shallowWithIntl(
|
|
606
|
-
createPost({
|
|
607
|
-
actions: {
|
|
608
|
-
...actionsProp,
|
|
609
|
-
openModal,
|
|
610
|
-
},
|
|
611
|
-
}),
|
|
612
|
-
);
|
|
613
|
-
|
|
614
|
-
wrapper.setState({
|
|
615
|
-
message: '/header',
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
const form = wrapper.find('#create_post');
|
|
619
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
620
|
-
expect(openModal).toHaveBeenCalledTimes(1);
|
|
621
|
-
expect(openModal.mock.calls[0][0].modalId).toEqual(ModalIdentifiers.EDIT_CHANNEL_HEADER);
|
|
622
|
-
expect(openModal.mock.calls[0][0].dialogProps.channel).toEqual(currentChannelProp);
|
|
623
|
-
});
|
|
624
|
-
|
|
625
|
-
it('onSubmit test for "/purpose" message', () => {
|
|
626
|
-
const openModal = jest.fn();
|
|
627
|
-
|
|
628
|
-
const wrapper = shallowWithIntl(
|
|
629
|
-
createPost({
|
|
630
|
-
actions: {
|
|
631
|
-
...actionsProp,
|
|
632
|
-
openModal,
|
|
633
|
-
},
|
|
634
|
-
}),
|
|
635
|
-
);
|
|
636
|
-
|
|
637
|
-
wrapper.setState({
|
|
638
|
-
message: '/purpose',
|
|
639
|
-
});
|
|
640
|
-
|
|
641
|
-
const form = wrapper.find('#create_post');
|
|
642
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
643
|
-
expect(openModal).toHaveBeenCalledTimes(1);
|
|
644
|
-
expect(openModal.mock.calls[0][0].modalId).toEqual(ModalIdentifiers.EDIT_CHANNEL_PURPOSE);
|
|
645
|
-
expect(openModal.mock.calls[0][0].dialogProps.channel).toEqual(currentChannelProp);
|
|
646
|
-
});
|
|
647
|
-
|
|
648
|
-
it('onSubmit test for "/rename" message', () => {
|
|
649
|
-
const wrapper = shallowWithIntl(createPost());
|
|
650
|
-
|
|
651
|
-
wrapper.setState({
|
|
652
|
-
message: '/rename',
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
const form = wrapper.find('#create_post');
|
|
656
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
657
|
-
expect(GlobalActions.showChannelNameUpdateModal).toHaveBeenCalledWith(currentChannelProp);
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
it('onSubmit test for "/unknown" message ', async () => {
|
|
661
|
-
jest.mock('actions/channel_actions.jsx', () => ({
|
|
662
|
-
executeCommand: jest.fn((message, _args, resolve) => resolve()),
|
|
663
|
-
}));
|
|
664
|
-
|
|
665
|
-
const wrapper = shallowWithIntl(createPost());
|
|
666
|
-
|
|
667
|
-
wrapper.setState({
|
|
668
|
-
message: '/unknown',
|
|
669
|
-
});
|
|
670
|
-
|
|
671
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
672
|
-
expect(wrapper.state('submitting')).toBe(false);
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
it('onSubmit test for addReaction message', async () => {
|
|
676
|
-
const addReaction = jest.fn();
|
|
677
|
-
|
|
678
|
-
const wrapper = shallowWithIntl(
|
|
679
|
-
createPost({
|
|
680
|
-
actions: {
|
|
681
|
-
...actionsProp,
|
|
682
|
-
addReaction,
|
|
683
|
-
},
|
|
684
|
-
}),
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
wrapper.setState({
|
|
688
|
-
message: '+:smile:',
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
692
|
-
expect(addReaction).toHaveBeenCalledWith('a', 'smile');
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
it('onSubmit test for removeReaction message', () => {
|
|
696
|
-
const removeReaction = jest.fn();
|
|
697
|
-
|
|
698
|
-
const wrapper = shallowWithIntl(
|
|
699
|
-
createPost({
|
|
700
|
-
actions: {
|
|
701
|
-
...actionsProp,
|
|
702
|
-
removeReaction,
|
|
703
|
-
},
|
|
704
|
-
}),
|
|
705
|
-
);
|
|
706
|
-
|
|
707
|
-
wrapper.setState({
|
|
708
|
-
message: '-:smile:',
|
|
709
|
-
});
|
|
710
|
-
|
|
711
|
-
const form = wrapper.find('#create_post');
|
|
712
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
713
|
-
expect(removeReaction).toHaveBeenCalledWith('a', 'smile');
|
|
714
|
-
});
|
|
715
|
-
|
|
716
|
-
/*it('check for postError state on handlePostError callback', () => {
|
|
717
|
-
const wrapper = shallowWithIntl(createPost());
|
|
718
|
-
const textBox = wrapper.find('#post_textbox');
|
|
719
|
-
const form = wrapper.find('#create_post');
|
|
720
|
-
|
|
721
|
-
textBox.prop('handlePostError')(true);
|
|
722
|
-
expect(wrapper.state('postError')).toBe(true);
|
|
723
|
-
|
|
724
|
-
wrapper.setState({
|
|
725
|
-
message: 'test',
|
|
726
|
-
});
|
|
727
|
-
|
|
728
|
-
form.simulate('Submit', {preventDefault: jest.fn()});
|
|
729
|
-
|
|
730
|
-
expect(wrapper.update().find('.post-error .animation--highlight').length).toBe(1);
|
|
731
|
-
expect(wrapper.find('#postCreateFooter').hasClass('post-create-footer has-error')).toBe(true);
|
|
732
|
-
});*/
|
|
733
|
-
|
|
734
|
-
it('check for handleFileUploadChange callback for focus', () => {
|
|
735
|
-
const wrapper = shallowWithIntl(createPost());
|
|
736
|
-
const instance = wrapper.instance();
|
|
737
|
-
instance.focusTextbox = jest.fn();
|
|
738
|
-
|
|
739
|
-
instance.handleFileUploadChange();
|
|
740
|
-
expect(instance.focusTextbox).toHaveBeenCalledTimes(1);
|
|
741
|
-
});
|
|
742
|
-
|
|
743
|
-
it('check for handleFileUploadStart callback', () => {
|
|
744
|
-
const setDraft = jest.fn();
|
|
745
|
-
|
|
746
|
-
const wrapper = shallowWithIntl(
|
|
747
|
-
createPost({
|
|
748
|
-
actions: {
|
|
749
|
-
...actionsProp,
|
|
750
|
-
setDraft,
|
|
751
|
-
},
|
|
752
|
-
}),
|
|
753
|
-
);
|
|
754
|
-
|
|
755
|
-
const instance = wrapper.instance();
|
|
756
|
-
const clientIds = ['a'];
|
|
757
|
-
const draft = {
|
|
758
|
-
...draftProp,
|
|
759
|
-
uploadsInProgress: [
|
|
760
|
-
...draftProp.uploadsInProgress,
|
|
761
|
-
...clientIds,
|
|
762
|
-
],
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
instance.handleUploadStart(clientIds, currentChannelProp.id);
|
|
766
|
-
expect(setDraft).toHaveBeenCalledWith(StoragePrefixes.DRAFT + currentChannelProp.id, draft);
|
|
767
|
-
});
|
|
768
|
-
|
|
769
|
-
it('check for handleFileUploadComplete callback', () => {
|
|
770
|
-
const setDraft = jest.fn();
|
|
771
|
-
|
|
772
|
-
const wrapper = shallowWithIntl(
|
|
773
|
-
createPost({
|
|
774
|
-
actions: {
|
|
775
|
-
...actionsProp,
|
|
776
|
-
setDraft,
|
|
777
|
-
},
|
|
778
|
-
}),
|
|
779
|
-
);
|
|
780
|
-
|
|
781
|
-
const instance = wrapper.instance();
|
|
782
|
-
const clientIds = ['a'];
|
|
783
|
-
const uploadsInProgressDraft = {
|
|
784
|
-
...draftProp,
|
|
785
|
-
uploadsInProgress: [
|
|
786
|
-
...draftProp.uploadsInProgress,
|
|
787
|
-
'a',
|
|
788
|
-
],
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
-
instance.draftsForChannel[currentChannelProp.id] = uploadsInProgressDraft;
|
|
792
|
-
|
|
793
|
-
wrapper.setProps({draft: uploadsInProgressDraft});
|
|
794
|
-
const fileInfos = {
|
|
795
|
-
id: 'a',
|
|
796
|
-
};
|
|
797
|
-
const expectedDraft = {
|
|
798
|
-
...draftProp,
|
|
799
|
-
fileInfos: [
|
|
800
|
-
...draftProp.fileInfos,
|
|
801
|
-
fileInfos,
|
|
802
|
-
],
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
instance.handleFileUploadComplete(fileInfos, clientIds, currentChannelProp.id);
|
|
806
|
-
expect(setDraft).toHaveBeenCalledWith(StoragePrefixes.DRAFT + currentChannelProp.id, expectedDraft);
|
|
807
|
-
});
|
|
808
|
-
|
|
809
|
-
it('check for handleUploadError callback', () => {
|
|
810
|
-
const setDraft = jest.fn();
|
|
811
|
-
|
|
812
|
-
const wrapper = shallowWithIntl(
|
|
813
|
-
createPost({
|
|
814
|
-
actions: {
|
|
815
|
-
...actionsProp,
|
|
816
|
-
setDraft,
|
|
817
|
-
},
|
|
818
|
-
}),
|
|
819
|
-
);
|
|
820
|
-
|
|
821
|
-
const instance = wrapper.instance();
|
|
822
|
-
const uploadsInProgressDraft = {
|
|
823
|
-
...draftProp,
|
|
824
|
-
uploadsInProgress: [
|
|
825
|
-
...draftProp.uploadsInProgress,
|
|
826
|
-
'a',
|
|
827
|
-
],
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
wrapper.setProps({draft: uploadsInProgressDraft});
|
|
831
|
-
|
|
832
|
-
instance.draftsForChannel[currentChannelProp.id] = uploadsInProgressDraft;
|
|
833
|
-
instance.handleUploadError('error message', 'a', currentChannelProp.id);
|
|
834
|
-
|
|
835
|
-
expect(setDraft).toHaveBeenCalledWith(StoragePrefixes.DRAFT + currentChannelProp.id, draftProp);
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
it('check for uploadsProgressPercent state on handleUploadProgress callback', () => {
|
|
839
|
-
const wrapper = shallowWithIntl(createPost({}));
|
|
840
|
-
wrapper.find(FileUpload).prop('onUploadProgress')({clientId: 'clientId', name: 'name', percent: 10, type: 'type'});
|
|
841
|
-
|
|
842
|
-
expect(wrapper.state('uploadsProgressPercent')).toEqual({clientId: {clientId: 'clientId', percent: 10, name: 'name', type: 'type'}});
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
it('Remove preview from fileInfos', () => {
|
|
846
|
-
const setDraft = jest.fn();
|
|
847
|
-
const fileInfos = {
|
|
848
|
-
id: 'a',
|
|
849
|
-
extension: 'jpg',
|
|
850
|
-
name: 'trimmedFilename',
|
|
851
|
-
};
|
|
852
|
-
const uploadsInProgressDraft = {
|
|
853
|
-
...draftProp,
|
|
854
|
-
fileInfos: [
|
|
855
|
-
...draftProp.fileInfos,
|
|
856
|
-
fileInfos,
|
|
857
|
-
],
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
const wrapper = shallowWithIntl(
|
|
861
|
-
createPost({
|
|
862
|
-
actions: {
|
|
863
|
-
...actionsProp,
|
|
864
|
-
setDraft,
|
|
865
|
-
},
|
|
866
|
-
draft: {
|
|
867
|
-
...draftProp,
|
|
868
|
-
...uploadsInProgressDraft,
|
|
869
|
-
},
|
|
870
|
-
}),
|
|
871
|
-
);
|
|
872
|
-
|
|
873
|
-
const instance = wrapper.instance();
|
|
874
|
-
instance.handleFileUploadChange = jest.fn();
|
|
875
|
-
instance.removePreview('a');
|
|
876
|
-
expect(setDraft).toHaveBeenCalledTimes(1);
|
|
877
|
-
expect(setDraft).toHaveBeenCalledWith(StoragePrefixes.DRAFT + currentChannelProp.id, draftProp);
|
|
878
|
-
expect(instance.handleFileUploadChange).toHaveBeenCalledTimes(1);
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
it('Should call Shortcut modal on FORWARD_SLASH+cntrl/meta', () => {
|
|
882
|
-
const wrapper = shallowWithIntl(createPost());
|
|
883
|
-
const instance = wrapper.instance();
|
|
884
|
-
instance.documentKeyHandler({ctrlKey: true, key: Constants.KeyCodes.BACK_SLASH[0], keyCode: Constants.KeyCodes.BACK_SLASH[1], preventDefault: jest.fn()});
|
|
885
|
-
expect(GlobalActions.toggleShortcutsModal).not.toHaveBeenCalled();
|
|
886
|
-
instance.documentKeyHandler({ctrlKey: true, key: 'ù', keyCode: Constants.KeyCodes.FORWARD_SLASH[1], preventDefault: jest.fn()});
|
|
887
|
-
expect(GlobalActions.toggleShortcutsModal).toHaveBeenCalled();
|
|
888
|
-
instance.documentKeyHandler({ctrlKey: true, key: '/', keyCode: Constants.KeyCodes.SEVEN[1], preventDefault: jest.fn()});
|
|
889
|
-
expect(GlobalActions.toggleShortcutsModal).toHaveBeenCalled();
|
|
890
|
-
instance.documentKeyHandler({ctrlKey: true, key: Constants.KeyCodes.FORWARD_SLASH[0], keyCode: Constants.KeyCodes.FORWARD_SLASH[1], preventDefault: jest.fn()});
|
|
891
|
-
expect(GlobalActions.toggleShortcutsModal).toHaveBeenCalled();
|
|
892
|
-
});
|
|
893
|
-
|
|
894
|
-
it('Should just return as ctrlSend is enabled and its ctrl+enter', () => {
|
|
895
|
-
const wrapper = shallowWithIntl(createPost({
|
|
896
|
-
ctrlSend: true,
|
|
897
|
-
}));
|
|
898
|
-
|
|
899
|
-
const instance = wrapper.instance();
|
|
900
|
-
instance.textboxRef.current = {blur: jest.fn()};
|
|
901
|
-
|
|
902
|
-
instance.handleKeyDown({ctrlKey: true, key: Constants.KeyCodes.ENTER[0], keyCode: Constants.KeyCodes.ENTER[1], preventDefault: jest.fn(), persist: jest.fn()});
|
|
903
|
-
setTimeout(() => {
|
|
904
|
-
expect(GlobalActions.emitLocalUserTypingEvent).toHaveBeenCalledWith(currentChannelProp.id, '');
|
|
905
|
-
}, 0);
|
|
906
|
-
});
|
|
907
|
-
|
|
908
|
-
it('Should call edit action as comment for arrow up', () => {
|
|
909
|
-
const setEditingPost = jest.fn();
|
|
910
|
-
const wrapper = shallowWithIntl(createPost({
|
|
911
|
-
actions: {
|
|
912
|
-
...actionsProp,
|
|
913
|
-
setEditingPost,
|
|
914
|
-
},
|
|
915
|
-
}));
|
|
916
|
-
const instance = wrapper.instance();
|
|
917
|
-
const type = Utils.localizeMessage('create_post.comment', Posts.MESSAGE_TYPES.COMMENT);
|
|
918
|
-
instance.handleKeyDown({key: Constants.KeyCodes.UP[0], preventDefault: jest.fn()});
|
|
919
|
-
expect(setEditingPost).toHaveBeenCalledWith(currentUsersLatestPostProp.id, 'post_textbox', type);
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
it('Should call edit action as post for arrow up', () => {
|
|
923
|
-
const setEditingPost = jest.fn();
|
|
924
|
-
const wrapper = shallowWithIntl(createPost({
|
|
925
|
-
actions: {
|
|
926
|
-
...actionsProp,
|
|
927
|
-
setEditingPost,
|
|
928
|
-
},
|
|
929
|
-
}));
|
|
930
|
-
const instance = wrapper.instance();
|
|
931
|
-
|
|
932
|
-
wrapper.setProps({
|
|
933
|
-
currentUsersLatestPost: {id: 'b', channel_id: currentChannelProp.id},
|
|
934
|
-
});
|
|
935
|
-
|
|
936
|
-
const type = Utils.localizeMessage('create_post.post', Posts.MESSAGE_TYPES.POST);
|
|
937
|
-
instance.handleKeyDown({key: Constants.KeyCodes.UP[0], preventDefault: jest.fn()});
|
|
938
|
-
expect(setEditingPost).toHaveBeenCalledWith(currentUsersLatestPostProp.id, 'post_textbox', type);
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
it('Should call moveHistoryIndexForward as ctrlKey and down arrow', () => {
|
|
942
|
-
const moveHistoryIndexForward = jest.fn(
|
|
943
|
-
() => {
|
|
944
|
-
return new Promise((resolve) => {
|
|
945
|
-
process.nextTick(() => resolve());
|
|
946
|
-
});
|
|
947
|
-
},
|
|
948
|
-
);
|
|
949
|
-
const wrapper = shallowWithIntl(createPost({
|
|
950
|
-
actions: {
|
|
951
|
-
...actionsProp,
|
|
952
|
-
moveHistoryIndexForward,
|
|
953
|
-
},
|
|
954
|
-
}));
|
|
955
|
-
const instance = wrapper.instance();
|
|
956
|
-
|
|
957
|
-
instance.handleKeyDown({key: Constants.KeyCodes.DOWN[0], ctrlKey: true, preventDefault: jest.fn()});
|
|
958
|
-
expect(moveHistoryIndexForward).toHaveBeenCalled();
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
it('Should call moveHistoryIndexBack as ctrlKey and up arrow', () => {
|
|
962
|
-
const moveHistoryIndexBack = jest.fn(
|
|
963
|
-
() => {
|
|
964
|
-
return new Promise((resolve) => {
|
|
965
|
-
process.nextTick(() => resolve());
|
|
966
|
-
});
|
|
967
|
-
},
|
|
968
|
-
);
|
|
969
|
-
const wrapper = shallowWithIntl(createPost({
|
|
970
|
-
actions: {
|
|
971
|
-
...actionsProp,
|
|
972
|
-
moveHistoryIndexBack,
|
|
973
|
-
},
|
|
974
|
-
}));
|
|
975
|
-
const instance = wrapper.instance();
|
|
976
|
-
|
|
977
|
-
instance.handleKeyDown({key: Constants.KeyCodes.UP[0], ctrlKey: true, preventDefault: jest.fn()});
|
|
978
|
-
expect(moveHistoryIndexBack).toHaveBeenCalled();
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
it('Show tutorial', () => {
|
|
982
|
-
const wrapper = shallowWithIntl(createPost({
|
|
983
|
-
showTutorialTip: true,
|
|
984
|
-
}));
|
|
985
|
-
expect(wrapper).toMatchSnapshot();
|
|
986
|
-
});
|
|
987
|
-
|
|
988
|
-
it('Toggle showPostDeletedModal state', () => {
|
|
989
|
-
const wrapper = shallowWithIntl(createPost());
|
|
990
|
-
const instance = wrapper.instance();
|
|
991
|
-
instance.showPostDeletedModal();
|
|
992
|
-
expect(wrapper.state('showPostDeletedModal')).toBe(true);
|
|
993
|
-
|
|
994
|
-
instance.hidePostDeletedModal();
|
|
995
|
-
expect(wrapper.state('showPostDeletedModal')).toBe(false);
|
|
996
|
-
});
|
|
997
|
-
|
|
998
|
-
it('Should have called actions.onSubmitPost on sendMessage', async () => {
|
|
999
|
-
const onSubmitPost = jest.fn();
|
|
1000
|
-
const wrapper = shallowWithIntl(createPost({
|
|
1001
|
-
actions: {
|
|
1002
|
-
...actionsProp,
|
|
1003
|
-
onSubmitPost,
|
|
1004
|
-
},
|
|
1005
|
-
}));
|
|
1006
|
-
const post = {message: 'message', file_ids: []};
|
|
1007
|
-
await wrapper.instance().sendMessage(post);
|
|
1008
|
-
|
|
1009
|
-
expect(onSubmitPost).toHaveBeenCalledTimes(1);
|
|
1010
|
-
expect(onSubmitPost.mock.calls[0][0]).toEqual(post);
|
|
1011
|
-
expect(onSubmitPost.mock.calls[0][1]).toEqual([]);
|
|
1012
|
-
});
|
|
1013
|
-
|
|
1014
|
-
it('Should have called actions.selectPostFromRightHandSideSearchByPostId on replyToLastPost', () => {
|
|
1015
|
-
const selectPostFromRightHandSideSearchByPostId = jest.fn();
|
|
1016
|
-
let latestReplyablePostId = '';
|
|
1017
|
-
const wrapper = shallowWithIntl(createPost({
|
|
1018
|
-
actions: {
|
|
1019
|
-
...actionsProp,
|
|
1020
|
-
selectPostFromRightHandSideSearchByPostId,
|
|
1021
|
-
},
|
|
1022
|
-
latestReplyablePostId,
|
|
1023
|
-
}));
|
|
1024
|
-
|
|
1025
|
-
wrapper.instance().replyToLastPost({preventDefault: jest.fn()});
|
|
1026
|
-
expect(selectPostFromRightHandSideSearchByPostId).not.toBeCalled();
|
|
1027
|
-
|
|
1028
|
-
latestReplyablePostId = 'latest_replyablePost_id';
|
|
1029
|
-
wrapper.setProps({latestReplyablePostId});
|
|
1030
|
-
wrapper.instance().replyToLastPost({preventDefault: jest.fn()});
|
|
1031
|
-
expect(selectPostFromRightHandSideSearchByPostId).toHaveBeenCalledTimes(1);
|
|
1032
|
-
expect(selectPostFromRightHandSideSearchByPostId.mock.calls[0][0]).toEqual(latestReplyablePostId);
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
it('should match snapshot for read only channel', () => {
|
|
1036
|
-
const wrapper = shallowWithIntl(createPost({readOnlyChannel: true}));
|
|
1037
|
-
expect(wrapper).toMatchSnapshot();
|
|
1038
|
-
});
|
|
1039
|
-
|
|
1040
|
-
it('should match snapshot when cannot post', () => {
|
|
1041
|
-
const wrapper = shallowWithIntl(createPost({canPost: false}));
|
|
1042
|
-
expect(wrapper).toMatchSnapshot();
|
|
1043
|
-
});
|
|
1044
|
-
|
|
1045
|
-
it('should match snapshot when file upload disabled', () => {
|
|
1046
|
-
const wrapper = shallowWithIntl(createPost({canUploadFiles: false}));
|
|
1047
|
-
expect(wrapper).toMatchSnapshot();
|
|
1048
|
-
});
|
|
1049
|
-
|
|
1050
|
-
it('should allow to force send invalid slash command as a message', async () => {
|
|
1051
|
-
const error = {
|
|
1052
|
-
message: 'No command found',
|
|
1053
|
-
server_error_id: 'api.command.execute_command.not_found.app_error',
|
|
1054
|
-
};
|
|
1055
|
-
const executeCommand = jest.fn(() => Promise.resolve({error}));
|
|
1056
|
-
const onSubmitPost = jest.fn();
|
|
1057
|
-
|
|
1058
|
-
const wrapper = shallowWithIntl(
|
|
1059
|
-
createPost({
|
|
1060
|
-
actions: {
|
|
1061
|
-
...actionsProp,
|
|
1062
|
-
executeCommand,
|
|
1063
|
-
onSubmitPost,
|
|
1064
|
-
},
|
|
1065
|
-
}),
|
|
1066
|
-
);
|
|
1067
|
-
|
|
1068
|
-
wrapper.setState({
|
|
1069
|
-
message: '/fakecommand some text',
|
|
1070
|
-
});
|
|
1071
|
-
|
|
1072
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
1073
|
-
expect(executeCommand).toHaveBeenCalled();
|
|
1074
|
-
expect(onSubmitPost).not.toHaveBeenCalled();
|
|
1075
|
-
|
|
1076
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
1077
|
-
|
|
1078
|
-
expect(onSubmitPost).toHaveBeenCalledWith(
|
|
1079
|
-
expect.objectContaining({
|
|
1080
|
-
message: '/fakecommand some text',
|
|
1081
|
-
}),
|
|
1082
|
-
expect.anything(),
|
|
1083
|
-
);
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
it('should throw away invalid command error if user resumes typing', async () => {
|
|
1087
|
-
const error = {
|
|
1088
|
-
message: 'No command found',
|
|
1089
|
-
server_error_id: 'api.command.execute_command.not_found.app_error',
|
|
1090
|
-
};
|
|
1091
|
-
const executeCommand = jest.fn(() => Promise.resolve({error}));
|
|
1092
|
-
const onSubmitPost = jest.fn();
|
|
1093
|
-
|
|
1094
|
-
const wrapper = shallowWithIntl(
|
|
1095
|
-
createPost({
|
|
1096
|
-
actions: {
|
|
1097
|
-
...actionsProp,
|
|
1098
|
-
executeCommand,
|
|
1099
|
-
onSubmitPost,
|
|
1100
|
-
},
|
|
1101
|
-
}),
|
|
1102
|
-
);
|
|
1103
|
-
|
|
1104
|
-
wrapper.setState({
|
|
1105
|
-
message: '/fakecommand some text',
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
1109
|
-
expect(executeCommand).toHaveBeenCalled();
|
|
1110
|
-
expect(onSubmitPost).not.toHaveBeenCalled();
|
|
1111
|
-
|
|
1112
|
-
wrapper.instance().handleChange({
|
|
1113
|
-
target: {value: 'some valid text'},
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
await wrapper.instance().handleSubmit({preventDefault: jest.fn()});
|
|
1117
|
-
|
|
1118
|
-
expect(onSubmitPost).toHaveBeenCalledWith(
|
|
1119
|
-
expect.objectContaining({
|
|
1120
|
-
message: 'some valid text',
|
|
1121
|
-
}),
|
|
1122
|
-
expect.anything(),
|
|
1123
|
-
);
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
it('should be able to format a pasted markdown table', () => {
|
|
1127
|
-
const wrapper = shallowWithIntl(createPost());
|
|
1128
|
-
const mockImpl = () => {
|
|
1129
|
-
return {
|
|
1130
|
-
setSelectionRange: jest.fn(),
|
|
1131
|
-
focus: jest.fn(),
|
|
1132
|
-
};
|
|
1133
|
-
};
|
|
1134
|
-
wrapper.instance().textboxRef.current = {getInputBox: jest.fn(mockImpl), focus: jest.fn(), blur: jest.fn()};
|
|
1135
|
-
|
|
1136
|
-
const event = {
|
|
1137
|
-
target: {
|
|
1138
|
-
id: 'post_textbox',
|
|
1139
|
-
},
|
|
1140
|
-
preventDefault: jest.fn(),
|
|
1141
|
-
clipboardData: {
|
|
1142
|
-
items: [1],
|
|
1143
|
-
types: ['text/html'],
|
|
1144
|
-
getData: () => {
|
|
1145
|
-
return '<table><tr><td>test</td><td>test</td></tr><tr><td>test</td><td>test</td></tr></table>';
|
|
1146
|
-
},
|
|
1147
|
-
},
|
|
1148
|
-
};
|
|
1149
|
-
|
|
1150
|
-
const markdownTable = '|test | test|\n|--- | ---|\n|test | test|\n';
|
|
1151
|
-
|
|
1152
|
-
wrapper.instance().pasteHandler(event);
|
|
1153
|
-
expect(wrapper.state('message')).toBe(markdownTable);
|
|
1154
|
-
});
|
|
1155
|
-
|
|
1156
|
-
it('should preserve the original message after pasting a markdown table', () => {
|
|
1157
|
-
const wrapper = shallowWithIntl(createPost());
|
|
1158
|
-
|
|
1159
|
-
const message = 'original message';
|
|
1160
|
-
wrapper.setState({
|
|
1161
|
-
message,
|
|
1162
|
-
caretPosition: message.length,
|
|
1163
|
-
});
|
|
1164
|
-
|
|
1165
|
-
const event = {
|
|
1166
|
-
target: {
|
|
1167
|
-
id: 'post_textbox',
|
|
1168
|
-
},
|
|
1169
|
-
preventDefault: jest.fn(),
|
|
1170
|
-
clipboardData: {
|
|
1171
|
-
items: [1],
|
|
1172
|
-
types: ['text/html'],
|
|
1173
|
-
getData: () => {
|
|
1174
|
-
return '<table><tr><td>test</td><td>test</td></tr><tr><td>test</td><td>test</td></tr></table>';
|
|
1175
|
-
},
|
|
1176
|
-
},
|
|
1177
|
-
};
|
|
1178
|
-
|
|
1179
|
-
const markdownTable = '|test | test|\n|--- | ---|\n|test | test|\n\n';
|
|
1180
|
-
const expectedMessage = `${message}\n${markdownTable}`;
|
|
1181
|
-
|
|
1182
|
-
const mockTop = () => {
|
|
1183
|
-
return document.createElement('div');
|
|
1184
|
-
};
|
|
1185
|
-
|
|
1186
|
-
const mockImpl = () => {
|
|
1187
|
-
return {
|
|
1188
|
-
setSelectionRange: jest.fn(),
|
|
1189
|
-
getBoundingClientRect: jest.fn(mockTop),
|
|
1190
|
-
focus: jest.fn(),
|
|
1191
|
-
};
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
|
-
wrapper.instance().textboxRef.current = {getInputBox: jest.fn(mockImpl), focus: jest.fn(), blur: jest.fn()};
|
|
1195
|
-
|
|
1196
|
-
wrapper.instance().pasteHandler(event);
|
|
1197
|
-
expect(wrapper.state('message')).toBe(expectedMessage);
|
|
1198
|
-
});
|
|
1199
|
-
|
|
1200
|
-
it('should be able to format a github codeblock (pasted as a table)', () => {
|
|
1201
|
-
const wrapper = shallowWithIntl(createPost());
|
|
1202
|
-
const mockImpl = () => {
|
|
1203
|
-
return {
|
|
1204
|
-
setSelectionRange: jest.fn(),
|
|
1205
|
-
focus: jest.fn(),
|
|
1206
|
-
};
|
|
1207
|
-
};
|
|
1208
|
-
wrapper.instance().textboxRef.current = {getInputBox: jest.fn(mockImpl), focus: jest.fn(), blur: jest.fn()};
|
|
1209
|
-
|
|
1210
|
-
const event = {
|
|
1211
|
-
target: {
|
|
1212
|
-
id: 'post_textbox',
|
|
1213
|
-
},
|
|
1214
|
-
preventDefault: jest.fn(),
|
|
1215
|
-
clipboardData: {
|
|
1216
|
-
items: [1],
|
|
1217
|
-
types: ['text/plain', 'text/html'],
|
|
1218
|
-
getData: (type) => {
|
|
1219
|
-
if (type === 'text/plain') {
|
|
1220
|
-
return '// a javascript codeblock example\nif (1 > 0) {\n return \'condition is true\';\n}';
|
|
1221
|
-
}
|
|
1222
|
-
return '<table class="highlight tab-size js-file-line-container" data-tab-size="8"><tbody><tr><td id="LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">//</span> a javascript codeblock example</span></td></tr><tr><td id="L2" class="blob-num js-line-number" data-line-number="2"> </td><td id="LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">if</span> (<span class="pl-c1">1</span> <span class="pl-k">></span> <span class="pl-c1">0</span>) {</td></tr><tr><td id="L3" class="blob-num js-line-number" data-line-number="3"> </td><td id="LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">\'</span>condition is true<span class="pl-pds">\'</span></span>);</td></tr><tr><td id="L4" class="blob-num js-line-number" data-line-number="4"> </td><td id="LC4" class="blob-code blob-code-inner js-file-line">}</td></tr></tbody></table>';
|
|
1223
|
-
},
|
|
1224
|
-
},
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
const codeBlockMarkdown = "```\n// a javascript codeblock example\nif (1 > 0) {\n return 'condition is true';\n}\n```";
|
|
1228
|
-
|
|
1229
|
-
wrapper.instance().pasteHandler(event);
|
|
1230
|
-
expect(wrapper.state('message')).toBe(codeBlockMarkdown);
|
|
1231
|
-
});
|
|
1232
|
-
|
|
1233
|
-
it('should be able to format a github codeblock (pasted as a table) with existing draft post', () => {
|
|
1234
|
-
const wrapper = shallowWithIntl(createPost());
|
|
1235
|
-
const mockImpl = () => {
|
|
1236
|
-
return {
|
|
1237
|
-
setSelectionRange: jest.fn(),
|
|
1238
|
-
focus: jest.fn(),
|
|
1239
|
-
};
|
|
1240
|
-
};
|
|
1241
|
-
wrapper.instance().textboxRef.current = {getInputBox: jest.fn(mockImpl), focus: jest.fn(), blur: jest.fn()};
|
|
1242
|
-
wrapper.setState({
|
|
1243
|
-
message: 'test',
|
|
1244
|
-
caretPosition: 'test'.length, // cursor is at the end
|
|
1245
|
-
});
|
|
1246
|
-
|
|
1247
|
-
const event = {
|
|
1248
|
-
target: {
|
|
1249
|
-
id: 'post_textbox',
|
|
1250
|
-
},
|
|
1251
|
-
preventDefault: jest.fn(),
|
|
1252
|
-
clipboardData: {
|
|
1253
|
-
items: [1],
|
|
1254
|
-
types: ['text/plain', 'text/html'],
|
|
1255
|
-
getData: (type) => {
|
|
1256
|
-
if (type === 'text/plain') {
|
|
1257
|
-
return '// a javascript codeblock example\nif (1 > 0) {\n return \'condition is true\';\n}';
|
|
1258
|
-
}
|
|
1259
|
-
return '<table class="highlight tab-size js-file-line-container" data-tab-size="8"><tbody><tr><td id="LC1" class="blob-code blob-code-inner js-file-line"><span class="pl-c"><span class="pl-c">//</span> a javascript codeblock example</span></td></tr><tr><td id="L2" class="blob-num js-line-number" data-line-number="2"> </td><td id="LC2" class="blob-code blob-code-inner js-file-line"><span class="pl-k">if</span> (<span class="pl-c1">1</span> <span class="pl-k">></span> <span class="pl-c1">0</span>) {</td></tr><tr><td id="L3" class="blob-num js-line-number" data-line-number="3"> </td><td id="LC3" class="blob-code blob-code-inner js-file-line"><span class="pl-en">console</span>.<span class="pl-c1">log</span>(<span class="pl-s"><span class="pl-pds">\'</span>condition is true<span class="pl-pds">\'</span></span>);</td></tr><tr><td id="L4" class="blob-num js-line-number" data-line-number="4"> </td><td id="LC4" class="blob-code blob-code-inner js-file-line">}</td></tr></tbody></table>';
|
|
1260
|
-
},
|
|
1261
|
-
},
|
|
1262
|
-
};
|
|
1263
|
-
|
|
1264
|
-
const codeBlockMarkdown = "test\n```\n// a javascript codeblock example\nif (1 > 0) {\n return 'condition is true';\n}\n```";
|
|
1265
|
-
|
|
1266
|
-
wrapper.instance().pasteHandler(event);
|
|
1267
|
-
expect(wrapper.state('message')).toBe(codeBlockMarkdown);
|
|
1268
|
-
});
|
|
1269
|
-
|
|
1270
|
-
it('should not enable the save button when message empty', () => {
|
|
1271
|
-
const wrapper = shallowWithIntl(createPost());
|
|
1272
|
-
const saveButton = wrapper.find('.post-body__actions a');
|
|
1273
|
-
|
|
1274
|
-
expect(saveButton.hasClass('disabled')).toBe(true);
|
|
1275
|
-
});
|
|
1276
|
-
|
|
1277
|
-
it('should enable the save button when message not empty', () => {
|
|
1278
|
-
const wrapper = shallowWithIntl(createPost({draft: {...draftProp, message: 'a message'}}));
|
|
1279
|
-
const saveButton = wrapper.find('.post-body__actions a');
|
|
1280
|
-
|
|
1281
|
-
expect(saveButton.hasClass('disabled')).toBe(false);
|
|
1282
|
-
});
|
|
1283
|
-
|
|
1284
|
-
it('should enable the save button when a file is available for upload', () => {
|
|
1285
|
-
const wrapper = shallowWithIntl(createPost({draft: {...draftProp, fileInfos: [{id: '1'}]}}));
|
|
1286
|
-
const saveButton = wrapper.find('.post-body__actions a');
|
|
1287
|
-
|
|
1288
|
-
expect(saveButton.hasClass('disabled')).toBe(false);
|
|
1289
|
-
});
|
|
1290
|
-
|
|
1291
|
-
testComponentForLineBreak(
|
|
1292
|
-
(value) => createPost({draft: {...draftProp, message: value}}),
|
|
1293
|
-
(instance) => instance.state().message,
|
|
1294
|
-
);
|
|
1295
|
-
|
|
1296
|
-
testComponentForMarkdownHotkeys(
|
|
1297
|
-
(value) => createPost({draft: {...draftProp, message: value}}),
|
|
1298
|
-
(wrapper, setSelectionRangeFn) => {
|
|
1299
|
-
wrapper.instance().textboxRef = {
|
|
1300
|
-
current: {
|
|
1301
|
-
getInputBox: jest.fn(() => {
|
|
1302
|
-
return {
|
|
1303
|
-
focus: jest.fn(),
|
|
1304
|
-
setSelectionRange: setSelectionRangeFn,
|
|
1305
|
-
};
|
|
1306
|
-
}),
|
|
1307
|
-
},
|
|
1308
|
-
};
|
|
1309
|
-
},
|
|
1310
|
-
(instance) => instance.find(Textbox),
|
|
1311
|
-
(instance) => instance.state().message,
|
|
1312
|
-
);
|
|
1313
|
-
|
|
1314
|
-
it('should adjust selection to correct text', () => {
|
|
1315
|
-
const value = 'Jalebi _Fafda_ and Sambharo';
|
|
1316
|
-
const wrapper = shallowWithIntl(createPost({draft: {...draftProp, message: value}}));
|
|
1317
|
-
|
|
1318
|
-
const setSelectionRangeFn = jest.fn();
|
|
1319
|
-
wrapper.instance().textboxRef = {
|
|
1320
|
-
current: {
|
|
1321
|
-
getInputBox: jest.fn(() => {
|
|
1322
|
-
return {
|
|
1323
|
-
focus: jest.fn(),
|
|
1324
|
-
setSelectionRange: setSelectionRangeFn,
|
|
1325
|
-
};
|
|
1326
|
-
}),
|
|
1327
|
-
},
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
const textbox = wrapper.find(Textbox);
|
|
1331
|
-
const e = makeSelectionEvent(value, 7, 14);
|
|
1332
|
-
textbox.props().onSelect(e);
|
|
1333
|
-
expect(setSelectionRangeFn).toHaveBeenCalledWith(8, 13);
|
|
1334
|
-
});
|
|
1335
|
-
});
|