mirror of https://github.com/grafana/grafana
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>pull/50850/head^2
parent
ab89fa0853
commit
902101c524
@ -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'; |
||||
|
||||
const setup = () => { |
||||
const testPanel = new PanelModel({ title: 'test', description: 'test panel' }); |
||||
const props: Props = { |
||||
panel: testPanel, |
||||
}; |
||||
return render(<PanelHeaderCorner {...props} />); |
||||
}; |
||||
|
||||
describe('Render', () => { |
||||
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(); |
||||
}); |
||||
}); |
||||
|
Loading…
Reference in new issue