aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/issue/popups
diff options
context:
space:
mode:
authorJeremy <47277647+jeremy-davis-sonarsource@users.noreply.github.com>2019-02-08 15:38:08 +0100
committersonartech <sonartech@sonarsource.com>2019-02-11 09:11:45 +0100
commit223a718fb3dfdf1f49ae61d149ccaeb0b8e31b21 (patch)
tree3c26962b305e10b737f83210fd5603821ce4f249 /server/sonar-web/src/main/js/components/issue/popups
parentfd4e41c3bbe85a34e2e83cb8cc8974bffc590c94 (diff)
downloadsonarqube-223a718fb3dfdf1f49ae61d149ccaeb0b8e31b21.tar.gz
sonarqube-223a718fb3dfdf1f49ae61d149ccaeb0b8e31b21.zip
SONAR-11611 comment prompt button label (#1219)
SONAR-11611 Change cancel button label when comment prompt is auto triggered
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.tsx5
-rw-r--r--server/sonar-web/src/main/js/components/issue/popups/__tests__/CommentPopup-test.tsx17
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');
+});