From 97979d89f3b7d1c1f38aa685b977a3efaa595962 Mon Sep 17 00:00:00 2001 From: Sudheer Date: Wed, 10 Oct 2018 23:59:32 +0530 Subject: [PATCH] MM-12560 Fix for infinite loading indicator for thread from search (#2246) * MM-12560 Fix for infinite loading indicator for thread from search * Change tests --- app/components/post_list/post_list_base.js | 2 +- .../thread/__snapshots__/thread.test.js.snap | 141 +++++++++++++----- app/screens/thread/thread.js | 2 +- app/screens/thread/thread.test.js | 7 +- 4 files changed, 110 insertions(+), 42 deletions(-) diff --git a/app/components/post_list/post_list_base.js b/app/components/post_list/post_list_base.js index 47973de0d..5ccf6723d 100644 --- a/app/components/post_list/post_list_base.js +++ b/app/components/post_list/post_list_base.js @@ -35,7 +35,7 @@ export default class PostListBase extends PureComponent { onPostPress: PropTypes.func, onRefresh: PropTypes.func, postIds: PropTypes.array.isRequired, - renderFooter: PropTypes.func, + renderFooter: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), renderReplies: PropTypes.bool, serverURL: PropTypes.string.isRequired, shouldRenderReplyButton: PropTypes.bool, diff --git a/app/screens/thread/__snapshots__/thread.test.js.snap b/app/screens/thread/__snapshots__/thread.test.js.snap index e78b7839e..79f7f0539 100644 --- a/app/screens/thread/__snapshots__/thread.test.js.snap +++ b/app/screens/thread/__snapshots__/thread.test.js.snap @@ -46,7 +46,13 @@ exports[`thread should match snapshot, has root post 1`] = ` "post_id_2", ] } - renderFooter={[Function]} + renderFooter={ + + } /> -`; - -exports[`thread should match snapshot, render footer 2`] = `null`; - -exports[`thread should match snapshot, render footer 3`] = ` - + } /> `; + +exports[`thread should match snapshot, render footer 2`] = ` + +`; + +exports[`thread should match snapshot, render footer 3`] = ` + + + + + + +`; diff --git a/app/screens/thread/thread.js b/app/screens/thread/thread.js index ee568d1b7..1f8dc0445 100644 --- a/app/screens/thread/thread.js +++ b/app/screens/thread/thread.js @@ -139,7 +139,7 @@ export default class Thread extends PureComponent { if (this.hasRootPost()) { content = ( { ); // return loading - expect(wrapper.instance().renderFooter()).toMatchSnapshot(); + expect(wrapper.find(PostList).getElement()).toMatchSnapshot(); // return null wrapper.setProps({threadLoadingStatus: {status: RequestStatus.SUCCESS}}); - expect(wrapper.instance().renderFooter()).toMatchSnapshot(); + expect(wrapper.find(PostList).getElement()).toMatchSnapshot(); // return deleted post const newPostIds = ['post_id_1', 'post_id_2']; wrapper.setProps({postIds: newPostIds}); - expect(wrapper.instance().renderFooter()).toMatchSnapshot(); + expect(wrapper.getElement()).toMatchSnapshot(); }); });