mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* Add integration with Jeager Add Jaeger datasource and modify derived fields in loki to allow for opening a trace in Jager in separate split. Modifies build so that this branch docker images are pushed to docker hub Add a traceui dir with docker-compose and provision files for demoing.:wq * Enable docker logger plugin to send logs to loki * Add placeholder zipkin datasource * Fixed rebase issues, added enhanceDataFrame to non-legacy code path * Trace selector for jaeger query field * Fix logs default mode for Loki * Fix loading jaeger query field services on split * Updated grafana image in traceui/compose file * Fix prettier error * Hide behind feature flag, clean up unused code. * Fix tests * Fix tests * Cleanup code and review feedback * Remove traceui directory * Remove circle build changes * Fix feature toggles object * Fix merge issues * Add trace ui in Explore * WIP * WIP * WIP * Make jaeger datasource return trace data instead of link * Allow js in jest tests * Return data from Jaeger datasource * Take yarn.lock from master * Fix missing component * Update yarn lock * Fix some ts and lint errors * Fix merge * Fix type errors * Make tests pass again * Add tests * Fix es5 compatibility Co-authored-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import { noop } from 'lodash';
|
|
import { shallow } from 'enzyme';
|
|
import { SecondaryActions } from './SecondaryActions';
|
|
|
|
const addQueryRowButtonSelector = '[aria-label="Add row button"]';
|
|
const richHistoryButtonSelector = '[aria-label="Rich history button"]';
|
|
|
|
describe('SecondaryActions', () => {
|
|
it('should render component two buttons', () => {
|
|
const wrapper = shallow(<SecondaryActions onClickAddQueryRowButton={noop} onClickRichHistoryButton={noop} />);
|
|
expect(wrapper.find(addQueryRowButtonSelector)).toHaveLength(1);
|
|
expect(wrapper.find(richHistoryButtonSelector)).toHaveLength(1);
|
|
});
|
|
|
|
it('should not render add row button if addQueryRowButtonHidden=true', () => {
|
|
const wrapper = shallow(
|
|
<SecondaryActions
|
|
addQueryRowButtonHidden={true}
|
|
onClickAddQueryRowButton={noop}
|
|
onClickRichHistoryButton={noop}
|
|
/>
|
|
);
|
|
expect(wrapper.find(addQueryRowButtonSelector)).toHaveLength(0);
|
|
expect(wrapper.find(richHistoryButtonSelector)).toHaveLength(1);
|
|
});
|
|
|
|
it('should disable add row button if addQueryRowButtonDisabled=true', () => {
|
|
const wrapper = shallow(
|
|
<SecondaryActions
|
|
addQueryRowButtonDisabled={true}
|
|
onClickAddQueryRowButton={noop}
|
|
onClickRichHistoryButton={noop}
|
|
/>
|
|
);
|
|
expect(wrapper.find(addQueryRowButtonSelector).props().disabled).toBe(true);
|
|
});
|
|
|
|
it('should map click handlers correctly', () => {
|
|
const onClickAddRow = jest.fn();
|
|
const onClickHistory = jest.fn();
|
|
const wrapper = shallow(
|
|
<SecondaryActions onClickAddQueryRowButton={onClickAddRow} onClickRichHistoryButton={onClickHistory} />
|
|
);
|
|
wrapper.find(addQueryRowButtonSelector).simulate('click');
|
|
expect(onClickAddRow).toBeCalled();
|
|
|
|
wrapper.find(richHistoryButtonSelector).simulate('click');
|
|
expect(onClickHistory).toBeCalled();
|
|
});
|
|
});
|