mirror of
https://github.com/grafana/grafana.git
synced 2025-09-26 05:53:52 +08:00

* Do not use pointer cursor on icon by default * Allow items alignment in the HorizontalGroup layout * Add util for rendering components based on their type (element or function) * Components for rendering query and transformation rows in a unified way * Apply new UI fo query and transformation rows * Add some tests * Minor fix for scroll area Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
24 lines
810 B
TypeScript
24 lines
810 B
TypeScript
import React from 'react';
|
|
import { QueryOperationAction } from './QueryOperationAction';
|
|
import { shallow } from 'enzyme';
|
|
|
|
describe('QueryOperationAction', () => {
|
|
it('renders', () => {
|
|
expect(() => shallow(<QueryOperationAction icon="add-panel" onClick={() => {}} />)).not.toThrow();
|
|
});
|
|
describe('when disabled', () => {
|
|
it('does not call onClick handler', () => {
|
|
const clickSpy = jest.fn();
|
|
const wrapper = shallow(<QueryOperationAction icon="add-panel" onClick={clickSpy} title="Test action" />);
|
|
const actionEl = wrapper.find({ 'aria-label': 'Test action query operation action' });
|
|
|
|
expect(actionEl).toHaveLength(1);
|
|
expect(clickSpy).not.toBeCalled();
|
|
|
|
actionEl.first().simulate('click');
|
|
|
|
expect(clickSpy).toBeCalledTimes(1);
|
|
});
|
|
});
|
|
});
|