From c7cdce01fa3af580e28689826e1a4bc8734fa252 Mon Sep 17 00:00:00 2001
From: CJ <38697367+imisshtml@users.noreply.github.com>
Date: Sun, 17 Nov 2019 23:33:14 -0500
Subject: [PATCH] MM-18054 Checked for prev post comment line (#3523)
* MM-18054 Checked for prev post comment line
Added check for prev post to stop the "Commented on" line when in same thread.
* MM-18054 Added Unit Tests
Added Unit Tests
* MM-18054 Update props
Updated the prop for isFirstReply
---
app/components/post/post.js | 2 +
.../__snapshots__/post_header.test.js.snap | 157 ++++++++++++++++++
app/components/post_header/post_header.js | 4 +-
.../post_header/post_header.test.js | 31 ++++
4 files changed, 193 insertions(+), 1 deletion(-)
diff --git a/app/components/post/post.js b/app/components/post/post.js
index 1afd68ce4..d008271aa 100644
--- a/app/components/post/post.js
+++ b/app/components/post/post.js
@@ -254,6 +254,7 @@ export default class Post extends PureComponent {
isLandscape,
previousPostExists,
beforePrevPostUserId,
+ isFirstReply,
} = this.props;
if (!post) {
@@ -305,6 +306,7 @@ export default class Post extends PureComponent {
theme={theme}
previousPostExists={previousPostExists}
beforePrevPostUserId={beforePrevPostUserId}
+ isFirstReply={isFirstReply}
/>
);
}
diff --git a/app/components/post_header/__snapshots__/post_header.test.js.snap b/app/components/post_header/__snapshots__/post_header.test.js.snap
index c37b24749..73b3b3730 100644
--- a/app/components/post_header/__snapshots__/post_header.test.js.snap
+++ b/app/components/post_header/__snapshots__/post_header.test.js.snap
@@ -244,6 +244,76 @@ exports[`PostHeader should match snapshot when post is from system message 1`] =
`;
+exports[`PostHeader should match snapshot when post is same thread, so dont display Commented On 1`] = `
+
+
+
+
+
+ John Smith
+
+
+
+
+
+
+`;
+
exports[`PostHeader should match snapshot when post isBot and shouldRenderReplyButton 1`] = `
`;
+exports[`PostHeader should match snapshot when post renders Commented On for new post 1`] = `
+
+
+
+
+
+ John Smith
+
+
+
+
+
+
+
+`;
+
exports[`PostHeader should match snapshot when post should display reply button 1`] = `
{
post: {id: 'post'},
beforePrevPostUserId: '0',
onPress: jest.fn(),
+ isFirstReply: true,
};
test('should match snapshot when just a base post', () => {
@@ -95,4 +96,34 @@ describe('PostHeader', () => {
expect(wrapper.getElement()).toMatchSnapshot();
expect(wrapper.find('#ReplyIcon').exists()).toEqual(false);
});
+
+ test('should match snapshot when post renders Commented On for new post', () => {
+ const props = {
+ ...baseProps,
+ isFirstReply: true,
+ renderReplies: true,
+ commentedOnDisplayName: 'John Doe',
+ previousPostExists: true,
+ };
+
+ const wrapper = shallow(
+
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
+
+ test('should match snapshot when post is same thread, so dont display Commented On', () => {
+ const props = {
+ ...baseProps,
+ isFirstReply: false,
+ renderReplies: true,
+ commentedOnDisplayName: 'John Doe',
+ previousPostExists: true,
+ };
+
+ const wrapper = shallow(
+
+ );
+ expect(wrapper.getElement()).toMatchSnapshot();
+ });
});
\ No newline at end of file