Skip to content

Commit

Permalink
fix: pinned filters not applied (#73825)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra authored Jul 31, 2020
1 parent 69844e4 commit 1c0b77c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 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 @@ -249,6 +249,27 @@ describe('Lens App', () => {
expect(defaultArgs.data.query.filterManager.setAppFilters).toHaveBeenCalledWith([]);
});

it('passes global filters to frame', async () => {
const args = makeDefaultArgs();
args.editorFrame = frame;
const indexPattern = ({ id: 'index1' } as unknown) as IIndexPattern;
const pinnedField = ({ name: 'pinnedField' } as unknown) as IFieldType;
const pinnedFilter = esFilters.buildExistsFilter(pinnedField, indexPattern);
args.data.query.filterManager.getFilters = jest.fn().mockImplementation(() => {
return [pinnedFilter];
});
const component = mount(<App {...args} />);
component.update();
expect(frame.mount).toHaveBeenCalledWith(
expect.any(Element),
expect.objectContaining({
dateRange: { fromDate: 'now-7d', toDate: 'now' },
query: { query: '', language: 'kuery' },
filters: [pinnedFilter],
})
);
});

it('sets breadcrumbs when the document title changes', async () => {
const defaultArgs = makeDefaultArgs();
instance = mount(<App {...defaultArgs} />);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/lens/public/app_plugin/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function App({
toDate: currentRange.to,
},
originatingApp,
filters: [],
filters: data.query.filterManager.getFilters(),
indicateNoData: false,
};
});
Expand Down

0 comments on commit 1c0b77c

Please sign in to comment.