mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Chore: Convert PanelHeaderCorner test to RTL (#51074)
* export props * Convert PanelHeaderCorner test to RTL * Update public/app/features/dashboard/dashgrid/PanelHeader/PanelHeaderCorner.test.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
This commit is contained in:
parent
ab89fa0853
commit
902101c524
@ -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"]
|
||||
],
|
||||
|
@ -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(<PanelHeaderCorner {...props} />);
|
||||
};
|
||||
|
||||
describe('Panel header corner test', () => {
|
||||
it('should render component', () => {
|
||||
const panel = new PanelModel({});
|
||||
const wrapper = shallow(<PanelHeaderCorner panel={panel} />);
|
||||
const instance = wrapper.instance() as PanelHeaderCorner;
|
||||
setup();
|
||||
|
||||
expect(instance.getInfoContent()).toBeDefined();
|
||||
expect(
|
||||
screen.getByRole('region', { name: selectors.components.Panels.Panel.headerCornerInfo('info') })
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ enum InfoMode {
|
||||
Links = 'Links',
|
||||
}
|
||||
|
||||
interface Props {
|
||||
export interface Props {
|
||||
panel: PanelModel;
|
||||
title?: string;
|
||||
description?: string;
|
||||
|
Loading…
Reference in New Issue
Block a user