From 3d3654259cb739997a55e2cace7f9900b02dcfe0 Mon Sep 17 00:00:00 2001 From: Kim Doberstein Date: Wed, 11 Nov 2026 19:38:50 -0600 Subject: [PATCH] fix empty dashboard drop target height --- packages/module/src/WidgetLayout/GridLayout.tsx | 1 + .../WidgetLayout/__tests__/GridLayout.test.tsx | 16 ++++++++++++++-- packages/module/src/styles.css | 7 ++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/module/src/WidgetLayout/GridLayout.tsx b/packages/module/src/WidgetLayout/GridLayout.tsx index 5b7d6f6..ecbfb3d 100644 --- a/packages/module/src/WidgetLayout/GridLayout.tsx +++ b/packages/module/src/WidgetLayout/GridLayout.tsx @@ -250,6 +250,7 @@ const GridLayout = ({ key={'grid-' + layoutVariant} layout={internalTemplate[layoutVariant]} width={effectiveWidth} + className={activeLayout.length === 0 ? 'pf-v6-widget-grid--empty' : undefined} droppingItem={droppingItemTemplate} gridConfig={{ cols: columns[layoutVariant], diff --git a/packages/module/src/WidgetLayout/__tests__/GridLayout.test.tsx b/packages/module/src/WidgetLayout/__tests__/GridLayout.test.tsx index 30cdf5c..07b54de 100644 --- a/packages/module/src/WidgetLayout/__tests__/GridLayout.test.tsx +++ b/packages/module/src/WidgetLayout/__tests__/GridLayout.test.tsx @@ -9,10 +9,11 @@ import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon'; // so we replace it with a pass-through that renders children and triggers onLayoutChange jest.mock('react-grid-layout', () => { const React = require('react'); - const MockGridLayout = ({ children, onLayoutChange, layout }: { + const MockGridLayout = ({ children, onLayoutChange, layout, className }: { children: React.ReactNode; onLayoutChange?: (layout: unknown[]) => void; layout?: unknown[]; + className?: string; [key: string]: unknown; }) => { const calledRef = React.useRef(false); @@ -22,7 +23,7 @@ jest.mock('react-grid-layout', () => { onLayoutChange?.(layout || []); } }); - return
{children}
; + return
{children}
; }; return { __esModule: true, @@ -212,6 +213,17 @@ describe('GridLayout', () => { }); describe('droppingWidgetType', () => { + it('marks an empty dashboard grid as the drop target', () => { + render( + + ); + expect(screen.getByTestId('mock-grid-layout')).toHaveClass('pf-v6-widget-grid--empty'); + }); + it('hides empty state when a widget is being dropped', () => { render(