From 223a718fb3dfdf1f49ae61d149ccaeb0b8e31b21 Mon Sep 17 00:00:00 2001 From: Jeremy <47277647+jeremy-davis-sonarsource@users.noreply.github.com> Date: Fri, 8 Feb 2019 15:38:08 +0100 Subject: SONAR-11611 comment prompt button label (#1219) SONAR-11611 Change cancel button label when comment prompt is auto triggered --- .../main/js/components/issue/popups/CommentPopup.tsx | 5 +++-- .../issue/popups/__tests__/CommentPopup-test.tsx | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'server/sonar-web/src/main/js/components/issue/popups') 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 { }; render() { - const { comment } = this.props; + const { comment, autoTriggered } = this.props; return (
@@ -93,7 +94,7 @@ export default class CommentPopup extends React.PureComponent { {!comment && translate('issue.comment.submit')} - {translate('cancel')} + {autoTriggered ? translate('skip') : translate('cancel')}
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( + + ); + expect( + element + .find('.js-issue-comment-cancel') + .childAt(0) + .text() + ).toBe('skip'); +}); -- cgit v1.2.3