mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Cases] [104961] Remove conditional preventing additional comment field to be blank (#117901)
* Remove conditional preventing additional comment field to be blank * Remove tests for unwanted feature * Update server to prevent empty string comments * PR fix Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
51f7986242
commit
782f152713
11 changed files with 9 additions and 54 deletions
|
@ -80,6 +80,9 @@ const pushToServiceHandler = async ({
|
|||
if (comments && Array.isArray(comments) && comments.length > 0) {
|
||||
res.comments = [];
|
||||
for (const currentComment of comments) {
|
||||
if (!currentComment.comment) {
|
||||
continue;
|
||||
}
|
||||
const comment = await externalService.createComment({
|
||||
incidentId: res.id,
|
||||
comment: currentComment,
|
||||
|
|
|
@ -400,14 +400,7 @@ describe('JiraParamsFields renders', () => {
|
|||
expect(comments.simulate('change', changeEvent));
|
||||
expect(editAction.mock.calls[1][1].comments.length).toEqual(1);
|
||||
});
|
||||
test('An empty comment does not trigger editAction', () => {
|
||||
const wrapper = mount(<JiraParamsFields {...defaultProps} />);
|
||||
const emptyComment = { target: { value: '' } };
|
||||
const comments = wrapper.find('[data-test-subj="commentsTextArea"] textarea');
|
||||
expect(editAction.mock.calls[0][1].comments.length).toEqual(0);
|
||||
expect(comments.simulate('change', emptyComment));
|
||||
expect(editAction.mock.calls.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('Clears any left behind priority when issueType changes and hasPriority becomes false', () => {
|
||||
useGetFieldsByIssueTypeMock
|
||||
.mockReturnValueOnce(useGetFieldsByIssueTypeResponse)
|
||||
|
|
|
@ -94,9 +94,7 @@ const JiraParamsFields: React.FunctionComponent<ActionParamsProps<JiraActionPara
|
|||
);
|
||||
const editComment = useCallback(
|
||||
(key, value) => {
|
||||
if (value.length > 0) {
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
}
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
},
|
||||
[editSubActionProperty]
|
||||
);
|
||||
|
|
|
@ -223,12 +223,5 @@ describe('ResilientParamsFields renders', () => {
|
|||
expect(comments.simulate('change', changeEvent));
|
||||
expect(editAction.mock.calls[0][1].comments.length).toEqual(1);
|
||||
});
|
||||
test('An empty comment does not trigger editAction', () => {
|
||||
const wrapper = mount(<ResilientParamsFields {...defaultProps} />);
|
||||
const emptyComment = { target: { value: '' } };
|
||||
const comments = wrapper.find('[data-test-subj="commentsTextArea"] textarea');
|
||||
expect(comments.simulate('change', emptyComment));
|
||||
expect(editAction.mock.calls.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -108,9 +108,7 @@ const ResilientParamsFields: React.FunctionComponent<ActionParamsProps<Resilient
|
|||
);
|
||||
const editComment = useCallback(
|
||||
(key, value) => {
|
||||
if (value.length > 0) {
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
}
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
},
|
||||
[editSubActionProperty]
|
||||
);
|
||||
|
|
|
@ -259,13 +259,5 @@ describe('ServiceNowITSMParamsFields renders', () => {
|
|||
expect(comments.simulate('change', changeEvent));
|
||||
expect(editAction.mock.calls[0][1].comments.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('An empty comment does not trigger editAction', () => {
|
||||
const wrapper = mountWithIntl(<ServiceNowITSMParamsFields {...defaultProps} />);
|
||||
const emptyComment = { target: { value: '' } };
|
||||
const comments = wrapper.find('[data-test-subj="commentsTextArea"] textarea');
|
||||
expect(comments.simulate('change', emptyComment));
|
||||
expect(editAction.mock.calls.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -75,9 +75,7 @@ const ServiceNowParamsFields: React.FunctionComponent<
|
|||
|
||||
const editComment = useCallback(
|
||||
(key, value) => {
|
||||
if (value.length > 0) {
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
}
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
},
|
||||
[editSubActionProperty]
|
||||
);
|
||||
|
|
|
@ -306,13 +306,5 @@ describe('ServiceNowSIRParamsFields renders', () => {
|
|||
expect(comments.simulate('change', changeEvent));
|
||||
expect(editAction.mock.calls[0][1].comments.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('An empty comment does not trigger editAction', () => {
|
||||
const wrapper = mountWithIntl(<ServiceNowSIRParamsFields {...defaultProps} />);
|
||||
const emptyComment = { target: { value: '' } };
|
||||
const comments = wrapper.find('[data-test-subj="commentsTextArea"] textarea');
|
||||
expect(comments.simulate('change', emptyComment));
|
||||
expect(editAction.mock.calls.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -72,9 +72,7 @@ const ServiceNowSIRParamsFields: React.FunctionComponent<
|
|||
|
||||
const editComment = useCallback(
|
||||
(key, value) => {
|
||||
if (value.length > 0) {
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
}
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
},
|
||||
[editSubActionProperty]
|
||||
);
|
||||
|
|
|
@ -125,13 +125,5 @@ describe('SwimlaneParamsFields renders', () => {
|
|||
expect(comments.simulate('change', changeEvent));
|
||||
expect(editAction.mock.calls[0][1].comments.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('An empty comment does not trigger editAction', () => {
|
||||
const wrapper = mountWithIntl(<SwimlaneParamsFields {...defaultProps} />);
|
||||
const emptyComment = { target: { value: '' } };
|
||||
const comments = wrapper.find('[data-test-subj="commentsTextArea"] textarea');
|
||||
expect(comments.simulate('change', emptyComment));
|
||||
expect(editAction.mock.calls.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -77,9 +77,7 @@ const SwimlaneParamsFields: React.FunctionComponent<ActionParamsProps<SwimlaneAc
|
|||
|
||||
const editComment = useCallback(
|
||||
(key, value) => {
|
||||
if (value.length > 0) {
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
}
|
||||
editSubActionProperty(key, [{ commentId: '1', comment: value }]);
|
||||
},
|
||||
[editSubActionProperty]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue