[data.ui.query] Write filters to query log from default editor. (#74474)
This commit is contained in:
parent
d84777f053
commit
910c883607
|
@ -186,6 +186,44 @@ describe('QueryStringInput', () => {
|
|||
expect(mockCallback).toHaveBeenCalledWith({ query: 'response:200', language: 'kuery' });
|
||||
});
|
||||
|
||||
it('Should fire onBlur callback on input blur', () => {
|
||||
const mockCallback = jest.fn();
|
||||
|
||||
const component = mount(
|
||||
wrapQueryStringInputInContext({
|
||||
query: kqlQuery,
|
||||
onBlur: mockCallback,
|
||||
indexPatterns: [stubIndexPatternWithFields],
|
||||
disableAutoFocus: true,
|
||||
})
|
||||
);
|
||||
|
||||
const inputWrapper = component.find(EuiTextArea).find('textarea');
|
||||
inputWrapper.simulate('blur');
|
||||
|
||||
expect(mockCallback).toHaveBeenCalledTimes(1);
|
||||
expect(mockCallback).toHaveBeenCalledWith();
|
||||
});
|
||||
|
||||
it('Should fire onChangeQueryInputFocus callback on input blur', () => {
|
||||
const mockCallback = jest.fn();
|
||||
|
||||
const component = mount(
|
||||
wrapQueryStringInputInContext({
|
||||
query: kqlQuery,
|
||||
onChangeQueryInputFocus: mockCallback,
|
||||
indexPatterns: [stubIndexPatternWithFields],
|
||||
disableAutoFocus: true,
|
||||
})
|
||||
);
|
||||
|
||||
const inputWrapper = component.find(EuiTextArea).find('textarea');
|
||||
inputWrapper.simulate('blur');
|
||||
|
||||
expect(mockCallback).toHaveBeenCalledTimes(1);
|
||||
expect(mockCallback).toHaveBeenCalledWith(false);
|
||||
});
|
||||
|
||||
it('Should use PersistedLog for recent search suggestions', async () => {
|
||||
const component = mount(
|
||||
wrapQueryStringInputInContext({
|
||||
|
|
|
@ -33,7 +33,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { debounce, compact, isEqual } from 'lodash';
|
||||
import { debounce, compact, isEqual, isFunction } from 'lodash';
|
||||
import { Toast } from 'src/core/public';
|
||||
import { IDataPluginServices, IIndexPattern, Query } from '../..';
|
||||
import { QuerySuggestion, QuerySuggestionTypes } from '../../autocomplete';
|
||||
|
@ -460,6 +460,9 @@ export class QueryStringInputUI extends Component<Props, State> {
|
|||
if (this.props.onChangeQueryInputFocus) {
|
||||
this.props.onChangeQueryInputFocus(false);
|
||||
}
|
||||
if (isFunction(this.props.onBlur)) {
|
||||
this.props.onBlur();
|
||||
}
|
||||
};
|
||||
|
||||
private onClickSuggestion = (suggestion: QuerySuggestion) => {
|
||||
|
|
Loading…
Reference in a new issue