From 8230b7efa53b43a38bc27daa36d405d7142c00a4 Mon Sep 17 00:00:00 2001 From: Joe Li Date: Tue, 9 Jun 2026 16:42:28 -0700 Subject: [PATCH] test(dashboard): cover combined edit+standalone URL params Adds the React-side analogue of the legacy `?edit=true&standalone=true` Cypress mount, asserting the two URL params remain orthogonal: standalone=2 hides DashboardHeader while editMode still drives the `dashboard--editing` wrapper class. Satisfies sc-107447 task 3. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../DashboardBuilder.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx index 03bebfe5540..f8fbfb9eaed 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx @@ -181,6 +181,26 @@ describe('DashboardBuilder', () => { } }); + test('should apply editing class and hide header when both edit and standalone params are set', () => { + // Combined-params analogue of the legacy `?edit=true&standalone=true` Cypress + // mount. The two URL params are orthogonal on the React side: standalone=2 + // suppresses DashboardHeader regardless of editMode, while editMode still + // drives the `dashboard--editing` class on the wrapper. + const originalHref = window.location.href; + window.history.replaceState({}, '', '/?edit=true&standalone=2'); + try { + const { getByTestId, queryByTestId } = setup({ + dashboardState: { ...mockState.dashboardState, editMode: true }, + }); + expect(getByTestId('dashboard-content-wrapper')).toHaveClass( + 'dashboard dashboard--editing', + ); + expect(queryByTestId('dashboard-header-container')).not.toBeInTheDocument(); + } finally { + window.history.replaceState({}, '', originalHref); + } + }); + test('should render a Sticky top-level Tabs if the dashboard has tabs', async () => { const { findAllByTestId } = setup({ dashboardLayout: undoableDashboardLayoutWithTabs,