Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Sep 27, 2024
1 parent 21ea0d0 commit 35186a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ test('DashboardGrid renders expanded panel', async () => {

test('DashboardGrid renders focused panel', async () => {
const { dashboardApi, component } = await createAndMountDashboardGrid();
dashboardApi.setFocusedPanelId('2');
const overlayMock = {
onClose: new Promise<void>((resolve) => {
resolve();
}),
close: async () => {},
};
dashboardApi.openOverlay(overlayMock, { focusedPanelId: '2' });
await new Promise((resolve) => setTimeout(resolve, 1));
component.update();
// Both panels should still exist in the dom, so nothing needs to be re-fetched once minimized.
Expand All @@ -130,7 +136,7 @@ test('DashboardGrid renders focused panel', async () => {
expect(component.find('#mockDashboardGridItem_1').hasClass('blurredPanel')).toBe(true);
expect(component.find('#mockDashboardGridItem_2').hasClass('focusedPanel')).toBe(true);

dashboardApi.setFocusedPanelId(undefined);
dashboardApi.clearOverlays();
await new Promise((resolve) => setTimeout(resolve, 1));
component.update();
expect(component.find('GridItem').length).toBe(2);
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/dashboard/public/mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ export function buildMockDashboard({
undefined,
undefined,
undefined,
{ lastSavedInput: initialInput, lastSavedId: savedObjectId }
{
anyMigrationRun: false,
isEmbeddedExternally: false,
lastSavedInput: initialInput,
lastSavedId: savedObjectId,
managed: false,
}
);
dashboardContainer?.setControlGroupApi(mockControlGroupApi);
return dashboardContainer;
Expand Down

0 comments on commit 35186a8

Please sign in to comment.