mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* fix: add placeholder to loki query editor * fix: use original placeholder * refactor: extract set placeholder into seperate function * fix: use correct monaco types * revert: unwanted change from merge
31 lines
833 B
TypeScript
31 lines
833 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { createLokiDatasource } from '../../mocks';
|
|
|
|
import MonacoQueryField from './MonacoQueryField';
|
|
import { Props } from './MonacoQueryFieldProps';
|
|
|
|
function renderComponent({ initialValue = '', onRunQuery = jest.fn(), onBlur = jest.fn() }: Partial<Props> = {}) {
|
|
const datasource = createLokiDatasource();
|
|
|
|
render(
|
|
<MonacoQueryField
|
|
datasource={datasource}
|
|
initialValue={initialValue}
|
|
history={[]}
|
|
onRunQuery={onRunQuery}
|
|
onBlur={onBlur}
|
|
placeholder="Enter a Loki query (run with Shift+Enter)"
|
|
/>
|
|
);
|
|
}
|
|
|
|
describe('MonacoQueryField', () => {
|
|
test('Renders with no errors', async () => {
|
|
renderComponent();
|
|
|
|
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
|
});
|
|
});
|