This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 5.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit 8df4b6d4e02009ad1ea0edbc8f705ed24c803276 Author: Levis Mbote <[email protected]> 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/HeaderActionsDropdown/index.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 0c679f4415..7b28ab4493 100644 --- a/superset-frontend/src/dashboard/components/Header/Header.test.tsx +++ b/superset-frontend/src/dashboard/components/Header/Header.test.tsx @@ -193,6 +193,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/HeaderActionsDropdown/index.tsx b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.tsx index 6bc712f6b8..1b41703c42 100644 --- a/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.tsx +++ b/superset-frontend/src/dashboard/components/Header/HeaderActionsDropdown/index.tsx @@ -97,11 +97,13 @@ export class HeaderActionsDropdown extends PureComponent< this.props.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;
