AppChrome: Unify logic for chromeless pages that should not have NavBar, CommandPalette, Search etc (#62281)

* Keybindings: No global keybindings on chromeless pages

* simplify condition

* Refactoring

* Align name and file

* Move logic into AppChrome

* minor fix

* Update Page.tsx

* Fixing test

* Fixed tests

* More fixes

* Fixed more tests

* Fixing final test

* Fixed search in old nav
This commit is contained in:
Torkel Ödegaard
2023-02-02 09:53:06 +01:00
committed by GitHub
parent ce50168b70
commit b8e7ef48d0
63 changed files with 318 additions and 497 deletions

View File

@@ -1,8 +1,7 @@
import { render, RenderResult, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import { TestProvider } from 'test/helpers/TestProvider';
import { PluginType, escapeStringForRegex } from '@grafana/data';
import { locationService } from '@grafana/runtime';
@@ -37,11 +36,9 @@ const renderBrowse = (
});
return render(
<Provider store={store}>
<Router history={locationService.getHistory()}>
<BrowsePage {...props} />
</Router>
</Provider>
<TestProvider store={store}>
<BrowsePage {...props} />
</TestProvider>
);
};

View File

@@ -1,8 +1,8 @@
import { getDefaultNormalizer, render, RenderResult, SelectorMatcherOptions, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
import { Provider } from 'react-redux';
import { MemoryRouter, Route } from 'react-router-dom';
import { Route } from 'react-router-dom';
import { TestProvider } from 'test/helpers/TestProvider';
import {
PluginErrorCode,
@@ -12,7 +12,7 @@ import {
WithAccessControlMetadata,
} from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { config } from '@grafana/runtime';
import { config, locationService } from '@grafana/runtime';
import { configureStore } from 'app/store/configureStore';
import { mockPluginApis, getCatalogPluginMock, getPluginsStateMock, mockUserPermissions } from '../__mocks__';
@@ -73,12 +73,12 @@ const renderPluginDetails = (
plugins: pluginsStateOverride || getPluginsStateMock([plugin]),
});
locationService.push({ pathname: `/plugins/${id}`, search: pageId ? `?page=${pageId}` : '' });
return render(
<MemoryRouter initialEntries={[{ pathname: `/plugins/${id}`, search: pageId ? `?page=${pageId}` : '' }]}>
<Provider store={store}>
<Route path="/plugins/:pluginId" component={PluginDetailsPage} />
</Provider>
</MemoryRouter>
<TestProvider store={store}>
<Route path="/plugins/:pluginId" component={PluginDetailsPage} />
</TestProvider>
);
};