mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: fix bug where dashboard did not enter fullscreen mode. (#32839)
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user