Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Avoid suggestion rendering and evaluation on fullscreen mode #102757

Merged
merged 3 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,57 @@ describe('editor_frame', () => {
})
);
});

it('should avoid completely to compute suggestion when in fullscreen mode', async () => {
const props = {
...getDefaultProps(),
initialContext: {
indexPatternId: '1',
fieldName: 'test',
},
visualizationMap: {
testVis: mockVisualization,
},
datasourceMap: {
testDatasource: mockDatasource,
testDatasource2: mockDatasource2,
},

ExpressionRenderer: expressionRendererMock,
};

const { instance: el } = await mountWithProvider(
<EditorFrame {...props} />,
props.plugins.data
);
instance = el;

expect(
instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement
).not.toBeUndefined();

await act(async () => {
(instance.find(FrameLayout).prop('dataPanel') as ReactElement)!.props.dispatch({
type: 'TOGGLE_FULLSCREEN',
});
});

instance.update();

expect(instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement).toBe(false);

await act(async () => {
(instance.find(FrameLayout).prop('dataPanel') as ReactElement)!.props.dispatch({
type: 'TOGGLE_FULLSCREEN',
});
});

instance.update();

expect(
instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement
).not.toBeUndefined();
});
});

describe('passing state back to the caller', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ export function EditorFrame(props: EditorFrameProps) {
)
}
suggestionsPanel={
allLoaded && (
allLoaded &&
!state.isFullscreenDatasource && (
<SuggestionPanel
frame={framePublicAPI}
activeDatasourceId={state.activeDatasourceId}
Expand Down