mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* logs: context: allow "infinite" scroll * Log Context: Add visual changes to infinite scrolling (#70461) * remove text showing how many log lines are loaded * better positioning of loading indicators * add border * fix import * better loading states * improve corner cases * increase page size 10 => 50 * updated unit test, simplified code * fixed tests * updated tests * removed unused code * fixed test * improved refid-handling in loki * removed unnecessary code * better variable name * refactor * refactor --------- Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import userEvent from '@testing-library/user-event';
|
|
import React from 'react';
|
|
|
|
import { LogContextButtons } from './LogContextButtons';
|
|
|
|
describe('LogContextButtons', () => {
|
|
it('should call onChangeWrapLines when the checkbox is used, case 1', async () => {
|
|
const onChangeWrapLines = jest.fn();
|
|
render(<LogContextButtons onChangeWrapLines={onChangeWrapLines} />);
|
|
const wrapLinesBox = screen.getByRole('checkbox', {
|
|
name: 'Wrap lines',
|
|
});
|
|
await userEvent.click(wrapLinesBox);
|
|
expect(onChangeWrapLines).toHaveBeenCalledTimes(1);
|
|
expect(onChangeWrapLines).toHaveBeenCalledWith(true);
|
|
});
|
|
|
|
it('should call onChangeWrapLines when the checkbox is used, case 2', async () => {
|
|
const onChangeWrapLines = jest.fn();
|
|
render(<LogContextButtons onChangeWrapLines={onChangeWrapLines} wrapLines />);
|
|
const wrapLinesBox = screen.getByRole('checkbox', {
|
|
name: 'Wrap lines',
|
|
});
|
|
await userEvent.click(wrapLinesBox);
|
|
expect(onChangeWrapLines).toHaveBeenCalledTimes(1);
|
|
expect(onChangeWrapLines).toHaveBeenCalledWith(false);
|
|
});
|
|
});
|