mirror of
https://github.com/grafana/grafana.git
synced 2025-01-28 17:24:59 -06:00
1c58202b26
* Replace icons in dashboard and settings * Replace icons in alerting * Update batch of icons * Implement icons accross various files * Style updates * Search: Fix recent and starred icons * Update styling and details * Replace new icon created by unicons * Fix e2e test, styling * Minor styling updates Co-authored-by: Clarity-89 <homes89@ukr.net>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { QueryRowActions, Props } from './QueryRowActions';
|
|
import { shallow } from 'enzyme';
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props: Props = {
|
|
isDisabled: false,
|
|
isNotStarted: true,
|
|
canToggleEditorModes: true,
|
|
onClickToggleEditorMode: () => {},
|
|
onClickToggleDisabled: () => {},
|
|
onClickRemoveButton: () => {},
|
|
latency: 0,
|
|
};
|
|
|
|
Object.assign(props, propOverrides);
|
|
|
|
const wrapper = shallow(<QueryRowActions {...props} />);
|
|
return wrapper;
|
|
};
|
|
|
|
describe('QueryRowActions', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
it('should render component without editor mode', () => {
|
|
const wrapper = setup({ canToggleEditorModes: false });
|
|
expect(wrapper.find({ 'aria-label': 'Edit mode button' })).toHaveLength(0);
|
|
});
|
|
it('should change icon to eye-slash when query row result is hidden', () => {
|
|
const wrapper = setup({ isDisabled: true });
|
|
expect(wrapper.find({ title: 'Enable query' })).toHaveLength(1);
|
|
});
|
|
it('should change icon to eye when query row result is not hidden', () => {
|
|
const wrapper = setup({ isDisabled: false });
|
|
expect(wrapper.find({ title: 'Disable query' })).toHaveLength(1);
|
|
});
|
|
});
|