grafana/public/app/features/dashboard/components/DashboardSettings/DashboardSettings.test.tsx
Torkel Ödegaard b8e7ef48d0
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
2023-02-02 09:53:06 +01:00

39 lines
1.1 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import React from 'react';
import { TestProvider } from 'test/helpers/TestProvider';
import { NavModel, NavModelItem } from '@grafana/data';
import { BackendSrv, setBackendSrv } from '@grafana/runtime';
import { createDashboardModelFixture } from '../../state/__fixtures__/dashboardFixtures';
import { DashboardSettings } from './DashboardSettings';
setBackendSrv({
get: jest.fn().mockResolvedValue([]),
} as unknown as BackendSrv);
describe('DashboardSettings', () => {
it('pressing escape navigates away correctly', async () => {
const dashboard = createDashboardModelFixture(
{
title: 'Foo',
},
{
folderId: 1,
}
);
const sectionNav: NavModel = { main: { text: 'Dashboards' }, node: { text: 'Dashboards' } };
const pageNav: NavModelItem = { text: 'My cool dashboard' };
render(
<TestProvider>
<DashboardSettings editview="settings" dashboard={dashboard} sectionNav={sectionNav} pageNav={pageNav} />
</TestProvider>
);
expect(await screen.findByRole('tab', { name: 'Tab Settings' })).toBeInTheDocument();
});
});