mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* remove old page component * add test to check initDashboard is only called once (prevent variables loading twice) * add help node * update unit tests * remove last mentions of topnav * fix unit tests * remove unused props from ButtonRow interface * remove prop from test
33 lines
809 B
TypeScript
33 lines
809 B
TypeScript
import { screen, render } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
|
|
import { ButtonRow, Props } from './ButtonRow';
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
canSave: false,
|
|
onSubmit: jest.fn(),
|
|
onTest: jest.fn(),
|
|
exploreUrl: '/explore',
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
return render(<ButtonRow {...props} />);
|
|
};
|
|
|
|
describe('<ButtonRow>', () => {
|
|
it('should render component', () => {
|
|
setup();
|
|
|
|
expect(screen.getByRole('link', { name: 'Explore' })).toBeInTheDocument();
|
|
});
|
|
it('should render save & test', () => {
|
|
setup({ canSave: true });
|
|
|
|
expect(screen.getByRole('button', { name: selectors.pages.DataSource.saveAndTest })).toBeInTheDocument();
|
|
});
|
|
});
|