set ephemeral message ("message deleted") without ("Only visible to you") visible to users other than the owner (#7201)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
f80d50adbd
Коммит
4e92d18017
@@ -11,6 +11,7 @@ import * as Utils from 'utils/utils.jsx';
|
|||||||
import * as PostUtils from 'utils/post_utils.jsx';
|
import * as PostUtils from 'utils/post_utils.jsx';
|
||||||
import {emitEmojiPosted} from 'actions/post_actions.jsx';
|
import {emitEmojiPosted} from 'actions/post_actions.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
import {Posts} from 'mattermost-redux/constants';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
@@ -215,7 +216,7 @@ export default class PostInfo extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let visibleMessage;
|
let visibleMessage;
|
||||||
if (isEphemeral && !this.props.compactDisplay) {
|
if (isEphemeral && !this.props.compactDisplay && post.state !== Posts.POST_DELETED) {
|
||||||
visibleMessage = (
|
visibleMessage = (
|
||||||
<span className='post__visibility'>
|
<span className='post__visibility'>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
|||||||
@@ -0,0 +1,488 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={false}
|
||||||
|
isFlagged={false}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__reply"
|
||||||
|
>
|
||||||
|
<Connect(DotMenu)
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
handleDropdownOpened={[Function]}
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="center"
|
||||||
|
isFlagged={false}
|
||||||
|
post={
|
||||||
|
Object {
|
||||||
|
"channel_id": "g6139tbospd18cmxroesdk3kkc",
|
||||||
|
"create_at": 1502715365009,
|
||||||
|
"delete_at": 0,
|
||||||
|
"edit_at": 1502715372443,
|
||||||
|
"hashtags": "",
|
||||||
|
"id": "e584uzbwwpny9kengqayx5ayzw",
|
||||||
|
"is_pinned": false,
|
||||||
|
"message": "post message",
|
||||||
|
"original_id": "",
|
||||||
|
"parent_id": "",
|
||||||
|
"pending_post_id": "",
|
||||||
|
"props": Object {},
|
||||||
|
"root_id": "",
|
||||||
|
"type": "",
|
||||||
|
"update_at": 1502715372443,
|
||||||
|
"user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<EmojiPickerOverlay
|
||||||
|
container={[Function]}
|
||||||
|
onEmojiClick={[Function]}
|
||||||
|
onHide={[Function]}
|
||||||
|
rightOffset={7}
|
||||||
|
show={false}
|
||||||
|
spaceRequiredAbove={422}
|
||||||
|
spaceRequiredBelow={436}
|
||||||
|
target={[Function]}
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
className="reacticon__container"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-smile-o"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<CommentIcon
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="commentIcon"
|
||||||
|
searchStyle=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, compact display 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={false}
|
||||||
|
isFlagged={false}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__reply"
|
||||||
|
>
|
||||||
|
<Connect(DotMenu)
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
handleDropdownOpened={[Function]}
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="center"
|
||||||
|
isFlagged={false}
|
||||||
|
post={
|
||||||
|
Object {
|
||||||
|
"channel_id": "g6139tbospd18cmxroesdk3kkc",
|
||||||
|
"create_at": 1502715365009,
|
||||||
|
"delete_at": 0,
|
||||||
|
"edit_at": 1502715372443,
|
||||||
|
"hashtags": "",
|
||||||
|
"id": "e584uzbwwpny9kengqayx5ayzw",
|
||||||
|
"is_pinned": false,
|
||||||
|
"message": "post message",
|
||||||
|
"original_id": "",
|
||||||
|
"parent_id": "",
|
||||||
|
"pending_post_id": "",
|
||||||
|
"props": Object {},
|
||||||
|
"root_id": "",
|
||||||
|
"type": "",
|
||||||
|
"update_at": 1502715372443,
|
||||||
|
"user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<EmojiPickerOverlay
|
||||||
|
container={[Function]}
|
||||||
|
onEmojiClick={[Function]}
|
||||||
|
onHide={[Function]}
|
||||||
|
rightOffset={7}
|
||||||
|
show={false}
|
||||||
|
spaceRequiredAbove={422}
|
||||||
|
spaceRequiredBelow={436}
|
||||||
|
target={[Function]}
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
className="reacticon__container"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-smile-o"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<CommentIcon
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="commentIcon"
|
||||||
|
searchStyle=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, ephemeral deleted post 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={true}
|
||||||
|
isFlagged={true}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__remove"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="post__remove theme"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, ephemeral post 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={true}
|
||||||
|
isFlagged={true}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="post__visibility"
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
defaultMessage="(Only visible to you)"
|
||||||
|
id="post_info.message.visible"
|
||||||
|
values={Object {}}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__remove"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="post__remove theme"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, flagged post 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={false}
|
||||||
|
isFlagged={true}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__reply"
|
||||||
|
>
|
||||||
|
<Connect(DotMenu)
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
handleDropdownOpened={[Function]}
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="center"
|
||||||
|
isFlagged={true}
|
||||||
|
post={
|
||||||
|
Object {
|
||||||
|
"channel_id": "g6139tbospd18cmxroesdk3kkc",
|
||||||
|
"create_at": 1502715365009,
|
||||||
|
"delete_at": 0,
|
||||||
|
"edit_at": 1502715372443,
|
||||||
|
"hashtags": "",
|
||||||
|
"id": "e584uzbwwpny9kengqayx5ayzw",
|
||||||
|
"is_pinned": false,
|
||||||
|
"message": "post message",
|
||||||
|
"original_id": "",
|
||||||
|
"parent_id": "",
|
||||||
|
"pending_post_id": "",
|
||||||
|
"props": Object {},
|
||||||
|
"root_id": "",
|
||||||
|
"type": "",
|
||||||
|
"update_at": 1502715372443,
|
||||||
|
"user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<EmojiPickerOverlay
|
||||||
|
container={[Function]}
|
||||||
|
onEmojiClick={[Function]}
|
||||||
|
onHide={[Function]}
|
||||||
|
rightOffset={7}
|
||||||
|
show={false}
|
||||||
|
spaceRequiredAbove={422}
|
||||||
|
spaceRequiredBelow={436}
|
||||||
|
target={[Function]}
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
className="reacticon__container"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-smile-o"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<CommentIcon
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="commentIcon"
|
||||||
|
searchStyle=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, military time 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={true}
|
||||||
|
/>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={false}
|
||||||
|
isFlagged={false}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__reply"
|
||||||
|
>
|
||||||
|
<Connect(DotMenu)
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
handleDropdownOpened={[Function]}
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="center"
|
||||||
|
isFlagged={false}
|
||||||
|
post={
|
||||||
|
Object {
|
||||||
|
"channel_id": "g6139tbospd18cmxroesdk3kkc",
|
||||||
|
"create_at": 1502715365009,
|
||||||
|
"delete_at": 0,
|
||||||
|
"edit_at": 1502715372443,
|
||||||
|
"hashtags": "",
|
||||||
|
"id": "e584uzbwwpny9kengqayx5ayzw",
|
||||||
|
"is_pinned": false,
|
||||||
|
"message": "post message",
|
||||||
|
"original_id": "",
|
||||||
|
"parent_id": "",
|
||||||
|
"pending_post_id": "",
|
||||||
|
"props": Object {},
|
||||||
|
"root_id": "",
|
||||||
|
"type": "",
|
||||||
|
"update_at": 1502715372443,
|
||||||
|
"user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<CommentIcon
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="commentIcon"
|
||||||
|
searchStyle=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`components/post_view/PostInfo should match snapshot, pinned post 1`] = `
|
||||||
|
<div
|
||||||
|
className="post__header--info"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="col"
|
||||||
|
>
|
||||||
|
<PostTime
|
||||||
|
eventTime={1502715365009}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
useMilitaryTime={false}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="post__pinned-badge"
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
defaultMessage="Pinned"
|
||||||
|
id="post_info.pinned"
|
||||||
|
values={Object {}}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<PostFlagIcon
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="centerPostFlag"
|
||||||
|
isEphemeral={false}
|
||||||
|
isFlagged={true}
|
||||||
|
postId="e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="col col__reply"
|
||||||
|
>
|
||||||
|
<Connect(DotMenu)
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
handleDropdownOpened={[Function]}
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="center"
|
||||||
|
isFlagged={true}
|
||||||
|
post={
|
||||||
|
Object {
|
||||||
|
"channel_id": "g6139tbospd18cmxroesdk3kkc",
|
||||||
|
"create_at": 1502715365009,
|
||||||
|
"delete_at": 0,
|
||||||
|
"edit_at": 1502715372443,
|
||||||
|
"hashtags": "",
|
||||||
|
"id": "e584uzbwwpny9kengqayx5ayzw",
|
||||||
|
"is_pinned": true,
|
||||||
|
"message": "post message",
|
||||||
|
"original_id": "",
|
||||||
|
"parent_id": "",
|
||||||
|
"pending_post_id": "",
|
||||||
|
"props": Object {},
|
||||||
|
"root_id": "",
|
||||||
|
"type": "",
|
||||||
|
"update_at": 1502715372443,
|
||||||
|
"user_id": "b4pfxi8sn78y8yq7phzxxfor7h",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<EmojiPickerOverlay
|
||||||
|
container={[Function]}
|
||||||
|
onEmojiClick={[Function]}
|
||||||
|
onHide={[Function]}
|
||||||
|
rightOffset={7}
|
||||||
|
show={false}
|
||||||
|
spaceRequiredAbove={422}
|
||||||
|
spaceRequiredBelow={436}
|
||||||
|
target={[Function]}
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
className="reacticon__container"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-smile-o"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<CommentIcon
|
||||||
|
commentCount={0}
|
||||||
|
handleCommentClick={[Function]}
|
||||||
|
id="g6139tbospd18cmxroesdk3kkc_e584uzbwwpny9kengqayx5ayzw"
|
||||||
|
idCount={-1}
|
||||||
|
idPrefix="commentIcon"
|
||||||
|
searchStyle=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
225
webapp/tests/components/post_view/post_info/post_info.test.jsx
Обычный файл
225
webapp/tests/components/post_view/post_info/post_info.test.jsx
Обычный файл
@@ -0,0 +1,225 @@
|
|||||||
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||||||
|
// See License.txt for license information.
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import {shallow} from 'enzyme';
|
||||||
|
|
||||||
|
import Constants from 'utils/constants.jsx';
|
||||||
|
import PostInfo from 'components/post_view/post_info/post_info.jsx';
|
||||||
|
import {Posts} from 'mattermost-redux/constants';
|
||||||
|
|
||||||
|
const post = {
|
||||||
|
channel_id: 'g6139tbospd18cmxroesdk3kkc',
|
||||||
|
create_at: 1502715365009,
|
||||||
|
delete_at: 0,
|
||||||
|
edit_at: 1502715372443,
|
||||||
|
hashtags: '',
|
||||||
|
id: 'e584uzbwwpny9kengqayx5ayzw',
|
||||||
|
is_pinned: false,
|
||||||
|
message: 'post message',
|
||||||
|
original_id: '',
|
||||||
|
parent_id: '',
|
||||||
|
pending_post_id: '',
|
||||||
|
props: {},
|
||||||
|
root_id: '',
|
||||||
|
type: '',
|
||||||
|
update_at: 1502715372443,
|
||||||
|
user_id: 'b4pfxi8sn78y8yq7phzxxfor7h'
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('components/post_view/PostInfo', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
global.window.mm_config = null;
|
||||||
|
global.window.EnableEmojiPicker = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={false}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, compact display', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={false}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, military time', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'false';
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={true}
|
||||||
|
isFlagged={false}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, flagged post', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={true}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, pinned post', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
post.is_pinned = true;
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={true}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, ephemeral post', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
post.is_pinned = false;
|
||||||
|
post.type = Constants.PostTypes.EPHEMERAL;
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={true}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should match snapshot, ephemeral deleted post', () => {
|
||||||
|
function emptyFunction() {} //eslint-disable-line no-empty-function
|
||||||
|
|
||||||
|
global.window.mm_config = {};
|
||||||
|
global.window.mm_config.EnableEmojiPicker = 'true';
|
||||||
|
|
||||||
|
post.type = Constants.PostTypes.EPHEMERAL;
|
||||||
|
post.state = Posts.POST_DELETED;
|
||||||
|
|
||||||
|
const wrapper = shallow(
|
||||||
|
<PostInfo
|
||||||
|
post={post}
|
||||||
|
handleCommentClick={emptyFunction}
|
||||||
|
handleDropdownOpened={emptyFunction}
|
||||||
|
compactDisplay={false}
|
||||||
|
lastPostCount={0}
|
||||||
|
replyCount={0}
|
||||||
|
getPostList={emptyFunction}
|
||||||
|
useMilitaryTime={false}
|
||||||
|
isFlagged={true}
|
||||||
|
actions={{
|
||||||
|
removePost: emptyFunction,
|
||||||
|
addReaction: emptyFunction
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
Ссылка в новой задаче
Block a user