Skip to content

Commit 606a565

Browse files
authored
Add missing test (#11)
1 parent 105fb9c commit 606a565

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/RunQueryButtons.test.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, screen } from '@testing-library/react';
2+
import {fireEvent, render, screen} from '@testing-library/react';
33

44
import { DataQuery } from '@grafana/data';
55
import { RunQueryButtons, RunQueryButtonsProps } from './RunQueryButtons';
@@ -46,4 +46,15 @@ describe('RunQueryButtons', () => {
4646
const stopButton = screen.queryByRole('button', { name: 'Stop query' });
4747
expect(stopButton).toBeInTheDocument();
4848
});
49+
50+
it('Stop query button should be disabled until run button is clicked', () => {
51+
const props = getDefaultProps();
52+
render(<RunQueryButtons {...props} />);
53+
const runButton = screen.getByRole('button', { name: 'Run query' });
54+
const stopButton = screen.getByRole('button', { name: 'Stop query' });
55+
expect(stopButton).toBeInTheDocument();
56+
expect(stopButton).toBeDisabled();
57+
fireEvent.click(runButton);
58+
expect(stopButton).not.toBeDisabled();
59+
});
4960
});

0 commit comments

Comments
 (0)