mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
149fc700aa
commit
45740d858a
3 changed files with 3 additions and 26 deletions
|
@ -421,13 +421,7 @@ describe.skip('<ThresholdWatchEdit /> create route', () => {
|
|||
|
||||
expect(exists('watchActionAccordion')).toBe(true);
|
||||
|
||||
// First, provide invalid fields and verify
|
||||
form.setInputValue('emailBodyInput', '');
|
||||
|
||||
expect(form.getErrorsMessages()).toContain('Email body is required.');
|
||||
expect(find('simulateActionButton').props().disabled).toEqual(true);
|
||||
|
||||
// Next, provide valid field and verify
|
||||
// Provide valid fields and verify
|
||||
find('watchActionAccordion.mockComboBox').simulate('change', [
|
||||
{ label: EMAIL_RECIPIENT, value: EMAIL_RECIPIENT },
|
||||
]); // Using mocked EuiComboBox
|
||||
|
|
|
@ -34,7 +34,6 @@ export class EmailAction extends BaseAction {
|
|||
validate() {
|
||||
const errors = {
|
||||
to: [],
|
||||
body: [],
|
||||
};
|
||||
|
||||
if (!this.to || !this.to.length) {
|
||||
|
@ -44,13 +43,6 @@ export class EmailAction extends BaseAction {
|
|||
})
|
||||
);
|
||||
}
|
||||
if (!this.body) {
|
||||
errors.body.push(
|
||||
i18n.translate('xpack.watcher.watchActions.email.emailBodyIsRequiredValidationMessage', {
|
||||
defaultMessage: 'Email body is required.',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
|
|
@ -87,12 +87,8 @@ export const EmailActionFields: React.FunctionComponent<Props> = ({
|
|||
/>
|
||||
</EuiFormRow>
|
||||
|
||||
<ErrableFormRow
|
||||
id="emailBody"
|
||||
errorKey="body"
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
errors={errors}
|
||||
isShowingErrors={hasErrors && body !== undefined}
|
||||
label={i18n.translate(
|
||||
'xpack.watcher.sections.watchEdit.threshold.emailAction.bodyTextAreaFieldLabel',
|
||||
{
|
||||
|
@ -108,13 +104,8 @@ export const EmailActionFields: React.FunctionComponent<Props> = ({
|
|||
onChange={e => {
|
||||
editAction({ key: 'body', value: e.target.value });
|
||||
}}
|
||||
onBlur={() => {
|
||||
if (!body) {
|
||||
editAction({ key: 'body', value: '' });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFormRow>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue