This is an automated email from the ASF dual-hosted git repository. diegopucci pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push: new b6df88a134 fix: fix bug where dashboard did not enter fullscreen mode. (#32839) b6df88a134 is described below commit b6df88a1343d4e0bf2a066747856f3df93e9755b Author: Levis Mbote <111055098+levisng...@users.noreply.github.com> AuthorDate: Mon Apr 7 18:20:49 2025 +0300 fix: fix bug where dashboard did not enter fullscreen mode. (#32839) --- .../dashboard/components/Header/Header.test.tsx | 34 ++++++++++++++++++++++ .../Header/useHeaderActionsDropdownMenu.tsx | 4 ++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/dashboard/components/Header/Header.test.tsx b/superset-frontend/src/dashboard/components/Header/Header.test.tsx index 987f729129..a901995a38 100644 --- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx @@ -197,6 +197,10 @@ beforeEach(() => { jest.clearAllMocks(); }); +beforeEach(() => { + window.history.pushState({}, 'Test page', '/dashboard?standalone=1'); +}); + test('should render', () => { const { container } = setup(); expect(container).toBeInTheDocument(); @@ -438,6 +442,36 @@ test('should NOT render MetadataBar when embedded', () => { ).not.toBeInTheDocument(); }); +test('should hide edit button and navbar, and show Exit fullscreen when in fullscreen mode', () => { + const fullscreenState = { + ...initialState, + dashboardState: { + ...initialState.dashboardState, + isFullscreenMode: true, + }, + }; + + setup(fullscreenState); + expect(screen.queryByTestId('edit-dashboard-button')).not.toBeInTheDocument(); + expect(screen.getByTestId('actions-trigger')).toBeInTheDocument(); + expect(screen.queryByTestId('main-navigation')).not.toBeInTheDocument(); +}); + +test('should show Exit fullscreen when in fullscreen mode', async () => { + setup(); + + fireEvent.click(screen.getByTestId('actions-trigger')); + + expect(await screen.findByText('Exit fullscreen')).toBeInTheDocument(); +}); + +test('should have fullscreen option in dropdown', async () => { + setup(); + await openActionsDropdown(); + expect(screen.getByText('Exit fullscreen')).toBeInTheDocument(); + expect(screen.queryByText('Enter fullscreen')).not.toBeInTheDocument(); +}); + test('should render MetadataBar when not in edit mode and not embedded', () => { const state = { dashboardInfo: { diff --git a/superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx b/superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx index 420e91e552..ef58671faa 100644 --- a/superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx +++ b/superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx @@ -97,11 +97,13 @@ export const useHeaderActionsMenu = ({ showPropertiesModal(); break; case MenuKeys.ToggleFullscreen: { + const isCurrentlyStandalone = + Number(getUrlParam(URL_PARAMS.standalone)) === 1; const url = getDashboardUrl({ pathname: window.location.pathname, filters: getActiveFilters(), hash: window.location.hash, - standalone: getUrlParam(URL_PARAMS.standalone), + standalone: isCurrentlyStandalone ? null : 1, }); window.location.replace(url); break;