Navigation: Move SectionNav to AppChrome (#64391)

* move section nav to app chrome

* unit tests

* Move SectionNav to AppChrome folder

* fix duplicate variable rendering

---------

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
Ashley Harrison
2023-04-18 14:58:00 +01:00
committed by GitHub
parent 2cec402647
commit 0741f47876
15 changed files with 190 additions and 120 deletions

View File

@@ -1,38 +0,0 @@
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();
});
});