diff --git a/.betterer.results b/.betterer.results index 27eaf34ea5c..6166bdc880a 100644 --- a/.betterer.results +++ b/.betterer.results @@ -113,9 +113,6 @@ exports[`no enzyme tests`] = { "public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx:2723773538": [ [0, 35, 13, "RegExp match", "2409514259"] ], - "public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx:2851646279": [ - [0, 19, 13, "RegExp match", "2409514259"] - ], "public/app/features/datasources/DataSourceDashboards.test.tsx:1369048021": [ [0, 19, 13, "RegExp match", "2409514259"] ], diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx index 20a88cff82d..5327d374cb4 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx @@ -1,16 +1,26 @@ -import { shallow } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; +import { selectors } from '@grafana/e2e-selectors'; + import { PanelModel } from '../../state'; -import { PanelHeaderCorner } from './PanelHeaderCorner'; +import PanelHeaderCorner, { Props } from './PanelHeaderCorner'; -describe('Render', () => { +const setup = () => { + const testPanel = new PanelModel({ title: 'test', description: 'test panel' }); + const props: Props = { + panel: testPanel, + }; + return render(); +}; + +describe('Panel header corner test', () => { it('should render component', () => { - const panel = new PanelModel({}); - const wrapper = shallow(); - const instance = wrapper.instance() as PanelHeaderCorner; + setup(); - expect(instance.getInfoContent()).toBeDefined(); + expect( + screen.getByRole('region', { name: selectors.components.Panels.Panel.headerCornerInfo('info') }) + ).toBeInTheDocument(); }); }); diff --git a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx index 09b5b83cfd1..313b6fea479 100644 --- a/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx +++ b/public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.tsx @@ -14,7 +14,7 @@ enum InfoMode { Links = 'Links', } -interface Props { +export interface Props { panel: PanelModel; title?: string; description?: string;