mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Scenes: Support new top nav * Page: Make Page component support new and old dashboard page layouts * Pass scrollbar props * Fixing flex layout for dashboard * Progress on dashboard settings working with topnav * Updated * Annotations working * Starting to work fully * Fix merge issue * Fixed tests * Added buttons to annotations editor * Updating tests * Move Page component to each page * fixed general settings page * Fixed versions * Fixed annotation item page * Variables section working * Fixed tests * Minor fixes to versions * Update * Fixing unit tests * Adding add variable button * Restore annotations edit form so it's the same as before * Fixed semicolon in dashboard permissions * Fixing unit tests * Fixing tests * Minor test update * Fixing unit test * Fixing e2e tests * fix for e2e test * fix a11y issues * Changing places Settings -> General * Trying to fix a11y * I hope this fixes the e2e test * Fixing merge issue * tweak
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
import { Provider } from 'react-redux';
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
|
|
|
import { NavModel, NavModelItem } from '@grafana/data';
|
|
import { setBackendSrv } from '@grafana/runtime';
|
|
import { GrafanaContext } from 'app/core/context/GrafanaContext';
|
|
import { configureStore } from 'app/store/configureStore';
|
|
|
|
import { DashboardModel } from '../../state';
|
|
|
|
import { DashboardSettings } from './DashboardSettings';
|
|
|
|
jest.mock('@grafana/runtime', () => ({
|
|
...jest.requireActual('@grafana/runtime'),
|
|
locationService: {
|
|
partial: jest.fn(),
|
|
},
|
|
}));
|
|
|
|
setBackendSrv({
|
|
get: jest.fn().mockResolvedValue([]),
|
|
} as any);
|
|
|
|
describe('DashboardSettings', () => {
|
|
it('pressing escape navigates away correctly', async () => {
|
|
const dashboard = new DashboardModel(
|
|
{
|
|
title: 'Foo',
|
|
},
|
|
{
|
|
folderId: 1,
|
|
}
|
|
);
|
|
|
|
const store = configureStore();
|
|
const context = getGrafanaContextMock();
|
|
const sectionNav: NavModel = { main: { text: 'Dashboards' }, node: { text: 'Dashboards' } };
|
|
const pageNav: NavModelItem = { text: 'My cool dashboard' };
|
|
|
|
render(
|
|
<GrafanaContext.Provider value={context}>
|
|
<Provider store={store}>
|
|
<BrowserRouter>
|
|
<DashboardSettings editview="settings" dashboard={dashboard} sectionNav={sectionNav} pageNav={pageNav} />
|
|
</BrowserRouter>
|
|
</Provider>
|
|
</GrafanaContext.Provider>
|
|
);
|
|
|
|
expect(await screen.findByRole('heading', { name: 'Settings' })).toBeInTheDocument();
|
|
});
|
|
});
|