diff options
Diffstat (limited to 'server/sonar-web/src/main/js/components/issue/popups')
-rw-r--r-- | server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx | 5 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx index 5d59b5d816e..50ee52e2ff3 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/CommentPopup.tsx @@ -30,6 +30,7 @@ interface Props { toggleComment: (visible: boolean) => void; placeholder: string; placement?: PopupPlacement; + autoTriggered?: boolean; } interface State { @@ -69,7 +70,7 @@ export default class CommentPopup extends React.PureComponent<Props, State> { }; render() { - const { comment } = this.props; + const { comment, autoTriggered } = this.props; return ( <DropdownOverlay placement={this.props.placement}> <div className="issue-comment-bubble-popup"> @@ -93,7 +94,7 @@ export default class CommentPopup extends React.PureComponent<Props, State> { {!comment && translate('issue.comment.submit')} </Button> <ResetButtonLink className="js-issue-comment-cancel" onClick={this.handleCancelClick}> - {translate('cancel')} + {autoTriggered ? translate('skip') : translate('cancel')} </ResetButtonLink> </div> <div className="issue-comment-form-tips"> diff --git a/server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx b/server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx index 0c2363a6ef8..643328d11bb 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx +++ b/server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx @@ -52,3 +52,20 @@ it('should render not allow to send comment with only spaces', () => { click(element.find('.js-issue-comment-submit')); expect(onComment.mock.calls.length).toBe(1); }); + +it('should render the alternative cancel button label', () => { + const element = shallow( + <CommentPopup + autoTriggered={true} + onComment={jest.fn()} + placeholder="" + toggleComment={jest.fn()} + /> + ); + expect( + element + .find('.js-issue-comment-cancel') + .childAt(0) + .text() + ).toBe('skip'); +}); |