Skip to content

Commit

Permalink
directly submit query (#97254)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Apr 19, 2021
1 parent 5035230 commit 4540a94
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions x-pack/plugins/lens/public/app_plugin/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,26 @@ describe('Lens App', () => {
);
});

it('updates the query if saved query is selected', () => {
const { component } = mountWith({});
act(() => {
component.find(TopNavMenu).prop('onSavedQueryUpdated')!({
id: '2',
attributes: {
title: 'new title',
description: '',
query: { query: 'abc:def', language: 'lucene' },
},
});
});
expect(TopNavMenu).toHaveBeenCalledWith(
expect.objectContaining({
query: { query: 'abc:def', language: 'lucene' },
}),
{}
);
});

it('clears all existing unpinned filters when the active saved query is cleared', () => {
const { component, frame, services } = mountWith({});
act(() =>
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/lens/public/app_plugin/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ export function App({
setState((s) => ({
...s,
savedQuery: { ...savedQuery }, // Shallow query for reference issues
query: savedQuery.attributes.query,
}));
}}
onClearSavedQuery={() => {
Expand Down

0 comments on commit 4540a94

Please sign in to comment.