Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
explore
/
Logs
/
File Content:
PopoverMenu.test.tsx
import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { createLogRow } from '../../logs/components/__mocks__/logRow'; import { PopoverMenu } from './PopoverMenu'; const row = createLogRow(); test('Does not render if the filter functions are not defined', () => { render(<PopoverMenu selection="test" x={0} y={0} row={row} close={() => {}} />); expect(screen.queryByText('Copy selection')).not.toBeInTheDocument(); }); test('Renders copy and line contains filter', async () => { const onClickFilterValue = jest.fn(); render( <PopoverMenu selection="test" x={0} y={0} row={row} close={() => {}} onClickFilterValue={onClickFilterValue} /> ); expect(screen.getByText('Copy selection')).toBeInTheDocument(); expect(screen.getByText('Add as line contains filter')).toBeInTheDocument(); await userEvent.click(screen.getByText('Add as line contains filter')); expect(onClickFilterValue).toHaveBeenCalledTimes(1); expect(onClickFilterValue).toHaveBeenCalledWith('test', row.dataFrame.refId); }); test('Renders copy and line does not contain filter', async () => { const onClickFilterOutValue = jest.fn(); render( <PopoverMenu selection="test" x={0} y={0} row={row} close={() => {}} onClickFilterOutValue={onClickFilterOutValue} /> ); expect(screen.getByText('Copy selection')).toBeInTheDocument(); expect(screen.getByText('Add as line does not contain filter')).toBeInTheDocument(); await userEvent.click(screen.getByText('Add as line does not contain filter')); expect(onClickFilterOutValue).toHaveBeenCalledTimes(1); expect(onClickFilterOutValue).toHaveBeenCalledWith('test', row.dataFrame.refId); }); test('Renders copy, line contains filter, and line does not contain filter', () => { render( <PopoverMenu selection="test" x={0} y={0} row={row} close={() => {}} onClickFilterValue={() => {}} onClickFilterOutValue={() => {}} /> ); expect(screen.getByText('Copy selection')).toBeInTheDocument(); expect(screen.getByText('Add as line contains filter')).toBeInTheDocument(); expect(screen.getByText('Add as line does not contain filter')).toBeInTheDocument(); }); test('Can be dismissed with escape', async () => { const close = jest.fn(); render( <PopoverMenu selection="test" x={0} y={0} row={row} close={close} onClickFilterValue={() => {}} onClickFilterOutValue={() => {}} /> ); expect(close).not.toHaveBeenCalled(); expect(screen.getByText('Copy selection')).toBeInTheDocument(); await userEvent.keyboard('{Escape}'); expect(close).toHaveBeenCalledTimes(1); });
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
utils
---
0755
LiveLogs.test.tsx
3336 bytes
0644
LiveLogs.tsx
6480 bytes
0644
Logs.test.tsx
15642 bytes
0644
Logs.tsx
33158 bytes
0644
LogsColumnSearch.tsx
723 bytes
0644
LogsContainer.tsx
12999 bytes
0644
LogsFeedback.tsx
880 bytes
0644
LogsMetaRow.test.tsx
8416 bytes
0644
LogsMetaRow.tsx
6298 bytes
0644
LogsNavigation.test.tsx
6481 bytes
0644
LogsNavigation.tsx
8205 bytes
0644
LogsNavigationPages.test.tsx
1946 bytes
0644
LogsNavigationPages.tsx
3616 bytes
0644
LogsSamplePanel.test.tsx
6694 bytes
0644
LogsSamplePanel.tsx
4578 bytes
0644
LogsTable.test.tsx
9592 bytes
0644
LogsTable.tsx
8078 bytes
0644
LogsTableActiveFields.tsx
3548 bytes
0644
LogsTableAvailableFields.tsx
1986 bytes
0644
LogsTableEmptyFields.tsx
523 bytes
0644
LogsTableMultiSelect.tsx
2624 bytes
0644
LogsTableNavField.tsx
2202 bytes
0644
LogsTableWrap.test.tsx
5832 bytes
0644
LogsTableWrap.tsx
19976 bytes
0644
LogsVolumePanel.test.tsx
1526 bytes
0644
LogsVolumePanel.tsx
3437 bytes
0644
LogsVolumePanelList.test.tsx
2866 bytes
0644
LogsVolumePanelList.tsx
5766 bytes
0644
PopoverMenu.test.tsx
2774 bytes
0644
PopoverMenu.tsx
2640 bytes
0644
N4ST4R_ID | Naxtarrr