[Discover] [Alerting] Make 'Test query' button pretty (#134605)

* [Discover] [Alerting] Made 'Test query' button in 'Create rule' flyout pretty

* [Discover] [Alerting] Fixed broken 'Test query' button tests
This commit is contained in:
Davis McPhee 2022-06-17 10:41:20 -03:00 committed by GitHub
parent 1e5b0d4c8b
commit f0f2a05297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -179,7 +179,7 @@ describe('EsQueryAlertTypeExpression', () => {
expect(wrapper.find('[data-test-subj="thresholdExpression"]').exists()).toBeTruthy();
expect(wrapper.find('[data-test-subj="forLastExpression"]').exists()).toBeTruthy();
const testQueryButton = wrapper.find('EuiButtonEmpty[data-test-subj="testQuery"]');
const testQueryButton = wrapper.find('EuiButton[data-test-subj="testQuery"]');
expect(testQueryButton.exists()).toBeTruthy();
expect(testQueryButton.prop('disabled')).toBe(false);
});
@ -189,7 +189,7 @@ describe('EsQueryAlertTypeExpression', () => {
...defaultEsQueryExpressionParams,
timeField: null,
} as unknown as EsQueryAlertParams<SearchType.esQuery>);
const testQueryButton = wrapper.find('EuiButtonEmpty[data-test-subj="testQuery"]');
const testQueryButton = wrapper.find('EuiButton[data-test-subj="testQuery"]');
expect(testQueryButton.exists()).toBeTruthy();
expect(testQueryButton.prop('disabled')).toBe(true);
});
@ -204,7 +204,7 @@ describe('EsQueryAlertTypeExpression', () => {
});
dataMock.search.search.mockImplementation(() => searchResponseMock$);
const wrapper = await setup(defaultEsQueryExpressionParams);
const testQueryButton = wrapper.find('EuiButtonEmpty[data-test-subj="testQuery"]');
const testQueryButton = wrapper.find('EuiButton[data-test-subj="testQuery"]');
testQueryButton.simulate('click');
expect(dataMock.search.search).toHaveBeenCalled();
@ -225,7 +225,7 @@ describe('EsQueryAlertTypeExpression', () => {
throw new Error('What is this query');
});
const wrapper = await setup(defaultEsQueryExpressionParams);
const testQueryButton = wrapper.find('EuiButtonEmpty[data-test-subj="testQuery"]');
const testQueryButton = wrapper.find('EuiButton[data-test-subj="testQuery"]');
testQueryButton.simulate('click');
expect(dataMock.search.search).toHaveBeenCalled();

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import React from 'react';
import { EuiButtonEmpty, EuiFormRow, EuiText } from '@elastic/eui';
import { EuiButton, EuiFormRow, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { useTestQuery } from './use_test_query';
@ -21,21 +21,21 @@ export function TestQueryRow({
return (
<>
<EuiFormRow>
<EuiButtonEmpty
<EuiButton
data-test-subj="testQuery"
color="primary"
iconSide="left"
flush="left"
iconType="play"
iconType="playFilled"
onClick={onTestQuery}
disabled={hasValidationErrors}
isLoading={testQueryLoading}
size="s"
>
<FormattedMessage
id="xpack.stackAlerts.esQuery.ui.testQuery"
defaultMessage="Test query"
/>
</EuiButtonEmpty>
</EuiButton>
</EuiFormRow>
{testQueryLoading && (
<EuiFormRow>