Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,10 @@ describe('ConfigureCases', () => {

expect(await screen.findByTestId('common-flyout')).toBeInTheDocument();

expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent(
i18n.EDIT_CUSTOM_FIELD
);

await userEvent.click(screen.getByTestId('custom-field-label-input'));
await userEvent.paste('!!');
await userEvent.click(screen.getByTestId('text-custom-field-required'));
Expand Down Expand Up @@ -941,6 +945,10 @@ describe('ConfigureCases', () => {
await userEvent.click(screen.getByTestId('add-custom-field'));

expect(await screen.findByTestId('common-flyout')).toBeInTheDocument();

expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent(
i18n.ADD_CUSTOM_FIELD
);
});

it('closes fly out for when click on cancel', async () => {
Expand Down Expand Up @@ -1177,6 +1185,10 @@ describe('ConfigureCases', () => {

expect(await screen.findByTestId('common-flyout')).toBeInTheDocument();

expect(await screen.findByTestId('common-flyout-header')).toHaveTextContent(
i18n.EDIT_TEMPLATE
);

await userEvent.clear(await screen.findByTestId('template-name-input'));
await userEvent.click(await screen.findByTestId('template-name-input'));
await userEvent.paste('Updated template name');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ export const ConfigureCases: React.FC = React.memo(() => {
}
onCloseFlyout={onCloseCustomFieldFlyout}
onSaveField={onCustomFieldSave}
renderHeader={() => <span>{i18n.ADD_CUSTOM_FIELD}</span>}
renderHeader={() => (
<span>{customFieldToEdit ? i18n.EDIT_CUSTOM_FIELD : i18n.ADD_CUSTOM_FIELD} </span>
)}
>
{({ onChange }) => (
<CustomFieldsForm onChange={onChange} initialValue={customFieldToEdit} />
Expand All @@ -504,7 +506,9 @@ export const ConfigureCases: React.FC = React.memo(() => {
}
onCloseFlyout={onCloseTemplateFlyout}
onSaveField={onTemplateSave}
renderHeader={() => <span>{i18n.CREATE_TEMPLATE}</span>}
renderHeader={() => (
<span>{templateToEdit ? i18n.EDIT_TEMPLATE : i18n.CREATE_TEMPLATE}</span>
)}
>
{({ onChange }) => (
<TemplateForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ export const ADD_CUSTOM_FIELD = i18n.translate(
}
);

export const EDIT_CUSTOM_FIELD = i18n.translate(
'xpack.cases.configureCases.customFields.editCustomField',
{
defaultMessage: 'Edit field',
}
);

export const CREATE_TEMPLATE = i18n.translate('xpack.cases.configureCases.templates.flyoutTitle', {
defaultMessage: 'Create template',
defaultMessage: 'Add template',
});

export const EDIT_TEMPLATE = i18n.translate('xpack.cases.configureCases.templates.editTemplate', {
defaultMessage: 'Edit template',
});