diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx index 26332f0cf0054..84ae2a21a9a92 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.test.tsx @@ -48,14 +48,16 @@ describe('open in discover drilldown', () => { instance.find('EuiSwitch').prop('onChange')!({} as unknown as FormEvent<{}>); expect(setConfig).toHaveBeenCalledWith({ openInNewTab: true }); }); - it('calls through to isCompatible helper', () => { + + it('calls through to isCompatible helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; - drilldown.isCompatible( + await drilldown.isCompatible( { openInNewTab: true }, { embeddable: { type: 'lens' } as IEmbeddable, filters } ); expect(isCompatible).toHaveBeenCalledWith(expect.objectContaining({ filters })); }); + it('calls through to getHref helper', async () => { const filters: Filter[] = [{ meta: { disabled: false } }]; await drilldown.execute( diff --git a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx index 37e8976255362..fa262c6b0d534 100644 --- a/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx +++ b/x-pack/plugins/lens/public/trigger_actions/open_in_discover_drilldown.tsx @@ -131,11 +131,11 @@ export class OpenInDiscoverDrilldown }; public readonly execute = async (config: Config, context: ActionContext) => { - const { getLocation } = await getDiscoverHelpersAsync(); - if (config.openInNewTab) { window.open(await this.getHref(config, context), '_blank'); } else { + const { getLocation } = await getDiscoverHelpersAsync(); + const { app, path, state } = await getLocation({ discover: this.deps.discover, dataViews: this.deps.dataViews(),