mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasource: updates PromExploreQueryEditor to prevent it from throwing error on edit (#21605)
* Datasource: updates PromExploreQueryEditor - rewrite to functional component * Datasource: updates PromQueryField - moves an extra field from children to the separate prop * Datasource: adds PromExploreExtraField * Datasource: updates PromExploreQueryEditor - fixes typo * Datasource: updates prometheus explore editor snapshots * Datasource: updates PromExploreExtraField export * Datasource: removes unnecessary div from PromExploreQueryEditor * Datasource: adds basic PromExploreExtraField snapshot test * Datasource: adds basic PromExploreQueryEditor test * Datasource: updates PromExploreQueryEditor snapshot to fix timezone issues * Datasource: updates PromExploreQueryEditor - onChangeQueryStep cleanup * Datasource: updates PromExploreQueryEditor test to check ExtraFieldElement render * Datasource: simplified PromExploreQueryEditor onStepChange method * Datasource: updates Prometheus module import * Datasource: updates PromExploreQueryEditor test * Datasource: updates PromExploreQueryEditor tests * Datasource: fixes PromExploreQueryEditor error on empty interval init * Datasource: adds a tooltip to PromExploreExtraField mounted in PromExploreQueryEditor * Datasource: updates PromExploreQueryEditor snapshots
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { PromExploreExtraField, PromExploreExtraFieldProps } from './PromExploreExtraField';
|
||||
|
||||
const setup = (propOverrides?: PromExploreExtraFieldProps) => {
|
||||
const label = 'Prometheus Explore Extra Field';
|
||||
const value = '123';
|
||||
const onChangeFunc = jest.fn();
|
||||
const onKeyDownFunc = jest.fn();
|
||||
|
||||
const props: any = {
|
||||
label,
|
||||
value,
|
||||
onChangeFunc,
|
||||
onKeyDownFunc,
|
||||
};
|
||||
|
||||
Object.assign(props, propOverrides);
|
||||
|
||||
return shallow(<PromExploreExtraField {...props} />);
|
||||
};
|
||||
|
||||
describe('PrometheusExploreExtraField', () => {
|
||||
it('should render component', () => {
|
||||
const wrapper = setup();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user