File tree Expand file tree Collapse file tree 6 files changed +28
-14
lines changed
Expand file tree Collapse file tree 6 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import * as React from 'react';
33import { FormattedMessage } from 'react-intl' ;
44import noop from 'lodash/noop' ;
55
6- import LoadingIndicator from '../../../../components/loading-indicator' ;
76import PlainButton from '../../../../components/plain-button' ;
87import ActivityThreadReplies from './ActivityThreadReplies' ;
98import ActivityThreadReplyForm from './ActivityThreadReplyForm' ;
@@ -113,19 +112,15 @@ const ActivityThread = ({
113112 < div className = "bcs-ActivityThread" data-testid = "activity-thread" >
114113 { children }
115114
116- { isRepliesLoading && (
117- < div className = "bcs-ActivityThread-loading" data-testid = "activity-thread-loading" >
118- < LoadingIndicator />
119- </ div >
120- ) }
121115 { renderButton ( ) }
122116
123- { ! isRepliesLoading && repliesTotalCount > 0 && repliesLength > 0 && (
117+ { repliesTotalCount > 0 && repliesLength > 0 && (
124118 < ActivityThreadReplies
125119 currentUser = { currentUser }
126120 getAvatarUrl = { getAvatarUrl }
127121 getMentionWithQuery = { getMentionWithQuery }
128122 getUserProfileUrl = { getUserProfileUrl }
123+ isRepliesLoading = { isRepliesLoading }
129124 mentionSelectorContacts = { mentionSelectorContacts }
130125 onDelete = { onReplyDelete }
131126 onEdit = { onReplyEdit }
Original file line number Diff line number Diff line change 2222 outline : auto ;
2323 }
2424}
25-
26- .bcs-ActivityThread-loading {
27- padding-bottom : $bdl-grid-unit * 5 ;
28- }
Original file line number Diff line number Diff line change 11// @flow
22import React from 'react' ;
33import Comment from '../comment' ;
4+ import LoadingIndicator from '../../../../components/loading-indicator' ;
45
56import type { GetAvatarUrlCallback , GetProfileUrlCallback } from '../../../common/flowTypes' ;
67import type { Translations } from '../../flowTypes' ;
@@ -14,6 +15,7 @@ type Props = {
1415 getAvatarUrl : GetAvatarUrlCallback ,
1516 getMentionWithQuery ?: Function ,
1617 getUserProfileUrl ?: GetProfileUrlCallback ,
18+ isRepliesLoading ?: boolean ,
1719 mentionSelectorContacts ?: SelectorItems < > ,
1820 onDelete ?: Function ,
1921 onEdit ?: Function ,
@@ -26,6 +28,7 @@ const ActivityThreadReplies = ({
2628 getAvatarUrl,
2729 getMentionWithQuery,
2830 getUserProfileUrl,
31+ isRepliesLoading,
2932 mentionSelectorContacts,
3033 onDelete,
3134 onEdit,
@@ -43,6 +46,11 @@ const ActivityThreadReplies = ({
4346
4447 return (
4548 < div className = "bcs-ActivityThreadReplies" data-testid = "activity-thread-replies" >
49+ { isRepliesLoading && (
50+ < div className = "bcs-ActivityThreadReplies-loading" data-testid = "activity-thread-replies-loading" >
51+ < LoadingIndicator />
52+ </ div >
53+ ) }
4654 { replies . map ( ( reply : CommentType ) => (
4755 < Comment
4856 key = { `${ reply . type } ${ reply . id } ` }
Original file line number Diff line number Diff line change 1515 content : ' ' ;
1616 }
1717}
18+
19+ .bcs-ActivityThreadReplies-loading {
20+ padding-bottom : $bdl-grid-unit * 5 ;
21+ }
Original file line number Diff line number Diff line change @@ -81,12 +81,11 @@ describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThrea
8181 expect ( queryByTestId ( 'activity-thread-replies' ) ) . not . toBeInTheDocument ( ) ;
8282 } ) ;
8383
84- test ( 'should render LoadingIndicator and do not render replies or button if repliesLoading is true' , ( ) => {
84+ test ( 'should render LoadingIndicator and do not render button if repliesLoading is true' , ( ) => {
8585 const { queryByTestId } = getWrapper ( { isRepliesLoading : true } ) ;
8686
87- expect ( queryByTestId ( 'activity-thread-replies' ) ) . not . toBeInTheDocument ( ) ;
8887 expect ( queryByTestId ( 'activity-thread-button' ) ) . not . toBeInTheDocument ( ) ;
89- expect ( queryByTestId ( 'activity-thread-loading' ) ) . toBeInTheDocument ( ) ;
88+ expect ( queryByTestId ( 'activity-thread-replies- loading' ) ) . toBeInTheDocument ( ) ;
9089 } ) ;
9190
9291 test ( 'should NOT have reply button when onReplyCreate is not passed' , ( ) => {
Original file line number Diff line number Diff line change @@ -14,4 +14,16 @@ describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThrea
1414 expect ( queryByText ( replies [ 1 ] . message ) ) . toBeVisible ( ) ;
1515 expect ( queryByText ( replies [ 0 ] . message ) ) . toBeVisible ( ) ;
1616 } ) ;
17+
18+ test ( 'should render loading indicator if isRepliesLoading is true' , ( ) => {
19+ const { queryByTestId } = getWrapper ( { isRepliesLoading : true } ) ;
20+
21+ expect ( queryByTestId ( 'activity-thread-replies-loading' ) ) . toBeInTheDocument ( ) ;
22+ } ) ;
23+
24+ test ( 'should not render loading indicator if isRepliesLoading is false' , ( ) => {
25+ const { queryByTestId } = getWrapper ( { isRepliesLoading : false } ) ;
26+
27+ expect ( queryByTestId ( 'activity-thread-replies-loading' ) ) . not . toBeInTheDocument ( ) ;
28+ } ) ;
1729} ) ;
You can’t perform that action at this time.
0 commit comments