File tree Expand file tree Collapse file tree 6 files changed +31
-1
lines changed
Expand file tree Collapse file tree 6 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ type Tasks = {
6363
6464type Comment = {
6565 ...BaseFeedItem ,
66+ isPending ?: boolean ,
6667 isRepliesLoading ?: boolean ,
6768 is_reply_comment ?: boolean ,
6869 message ?: string ,
Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ const ActiveState = ({
170170 getMentionWithQuery = { getMentionWithQuery }
171171 getUserProfileUrl = { getUserProfileUrl }
172172 hasReplies = { hasReplies }
173+ isPending = { item . isPending }
173174 isRepliesLoading = { item . isRepliesLoading }
174175 mentionSelectorContacts = { mentionSelectorContacts }
175176 onHideReplies = { onHideRepliesHandler ( item . id ) }
@@ -266,6 +267,7 @@ const ActiveState = ({
266267 getMentionWithQuery = { getMentionWithQuery }
267268 getUserProfileUrl = { getUserProfileUrl }
268269 hasReplies = { hasReplies }
270+ isPending = { item . isPending }
269271 isRepliesLoading = { item . isRepliesLoading }
270272 mentionSelectorContacts = { mentionSelectorContacts }
271273 onHideReplies = { onHideRepliesHandler ( item . id ) }
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ type Props = {
2424 getUserProfileUrl ?: GetProfileUrlCallback ,
2525 hasReplies : boolean ,
2626 isAlwaysExpanded ?: boolean ,
27+ isPending ?: boolean ,
2728 isRepliesLoading ?: boolean ,
2829 mentionSelectorContacts ?: SelectorItems < > ,
2930 onHideReplies ?: ( lastReply : CommentType ) => void ,
@@ -53,6 +54,7 @@ const ActivityThread = ({
5354 getUserProfileUrl,
5455 hasReplies,
5556 isAlwaysExpanded = false ,
57+ isPending,
5658 isRepliesLoading,
5759 mentionSelectorContacts,
5860 onHideReplies = noop ,
@@ -146,6 +148,7 @@ const ActivityThread = ({
146148 { onReplyCreate && (
147149 < ActivityThreadReplyForm
148150 getMentionWithQuery = { getMentionWithQuery }
151+ isDisabled = { isPending }
149152 mentionSelectorContacts = { mentionSelectorContacts }
150153 onFocus = { handleFormFocusOrShow }
151154 onHide = { handleFormHide }
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import './ActivityThreadReplyForm.scss';
1616
1717type ActivityThreadReplyFromProps = {
1818 getMentionWithQuery ?: ( searchStr : string ) => void ,
19+ isDisabled ? : boolean ,
1920 mentionSelectorContacts ?: SelectorItems < > ,
2021 onFocus : ( ) => void ,
2122 onHide : ( ) => void ,
@@ -28,6 +29,7 @@ type Props = ActivityThreadReplyFromProps & InjectIntlProvidedProps;
2829function ActivityThreadReplyForm ( {
2930 mentionSelectorContacts,
3031 getMentionWithQuery,
32+ isDisabled,
3133 onFocus,
3234 onHide,
3335 onReplyCreate,
@@ -67,7 +69,12 @@ function ActivityThreadReplyForm({
6769 placeholder = { placeholder }
6870 />
6971 ) : (
70- < PlainButton className = "bcs-ActivityThreadReplyForm-toggle" onClick = { showForm } role = "button" type = "button" >
72+ < PlainButton
73+ className = "bcs-ActivityThreadReplyForm-toggle"
74+ onClick = { showForm }
75+ type = "button"
76+ isDisabled = { isDisabled }
77+ >
7178 < ArrowArcRight className = "bcs-ActivityThreadReplyForm-arrow" />
7279 < FormattedMessage { ...messages . reply } />
7380 </ PlainButton >
Original file line number Diff line number Diff line change @@ -99,4 +99,10 @@ describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThrea
9999
100100 expect ( screen . getByRole ( 'button' , { name : localize ( messages . reply . id ) } ) ) . toBeInTheDocument ( ) ;
101101 } ) ;
102+
103+ test ( 'should disable reply button when ietm is in pending state' , ( ) => {
104+ getWrapper ( { isPending : true , onReplyCreate : jest . fn ( ) } ) ;
105+ const replyButton = screen . getByRole ( 'button' , { name : localize ( messages . reply . id ) } ) ;
106+ expect ( replyButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
107+ } ) ;
102108} ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThrea
1919 wrapper : Wrapper ,
2020 } ) ;
2121
22+ test ( 'should disable Reply button if isDisabled property is true' , ( ) => {
23+ const onShow = jest . fn ( ) ;
24+ renderComponent ( { isDisabled : true , onShow } ) ;
25+ const replyButton = screen . getByRole ( 'button' , { name : localize ( messages . reply . id ) } ) ;
26+
27+ expect ( replyButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
28+
29+ fireEvent . click ( replyButton ) ;
30+ expect ( onShow ) . not . toBeCalled ( ) ;
31+ } ) ;
32+
2233 test ( 'should show reply form and should call onShow prop when clicked on Reply button' , ( ) => {
2334 const onShow = jest . fn ( ) ;
2435 renderComponent ( { onShow } ) ;
You can’t perform that action at this time.
0 commit comments