File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { render , screen } from '@testing-library/react' ;
2+ import { fireEvent , render , screen } from '@testing-library/react' ;
33
44import { DataQuery } from '@grafana/data' ;
55import { 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} ) ;
You can’t perform that action at this time.
0 commit comments