mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* refactor: modify interfaces to make tooltip or aria-label required * refactor: change functionality around aria-label and tooltip * refactor: change and add information in storybook documentation * refactor: remove default from tooltip * refactor: IconButton to make tooltip or aria-label required * refactor: Fix tests * refactor: Fix tests * refactor: Fix tests * refactor: Fix tests * feat: add migration guide for breaking change * feat: add latest requirements to storybook docs * refactor: separate iconbutton story with and without tooltip * refactor: remove exported baseArgs * refactor: clean up and restructure original story * refactor: adjust styling * refactor: enable control for tooltip * refactor: clean up * refactor: enable control for aria-label * refactor: fix theme getting the wrong theme * refactor: fix tests * refactor: adjust story * refactor: remove confusing story * refactor: adjust controls for stories
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
|
|
import { QueryOperationRowHeader, QueryOperationRowHeaderProps } from './QueryOperationRowHeader';
|
|
|
|
const setup = (propOverrides?: Partial<QueryOperationRowHeaderProps>) => {
|
|
const props: QueryOperationRowHeaderProps = {
|
|
title: 'test-title',
|
|
draggable: true,
|
|
isContentVisible: true,
|
|
id: 'test-id',
|
|
onRowToggle: jest.fn(),
|
|
reportDragMousePosition: jest.fn(),
|
|
...propOverrides,
|
|
};
|
|
return render(<QueryOperationRowHeader {...props}></QueryOperationRowHeader>);
|
|
};
|
|
|
|
describe('QueryOperationRowHeader', () => {
|
|
test('renders without exploding', () => {
|
|
expect(() => setup()).not.toThrow();
|
|
});
|
|
|
|
describe('collapsable property', () => {
|
|
test('should show the button to collapse the query row by default', () => {
|
|
setup();
|
|
expect(screen.getByLabelText('Collapse query row')).toBeInTheDocument();
|
|
});
|
|
test('should hide the button to collapse the query row when collapsable is set as false', () => {
|
|
setup({ collapsable: false });
|
|
expect(screen.queryByLabelText('Collapse query row')).not.toBeInTheDocument();
|
|
});
|
|
});
|
|
});
|