mirror of https://github.com/grafana/grafana
Add Panel: fixes No gap between rows in safari (#35570)
* Add Panel: fixes No gap between rows in safari * removes extra margin from bottom and far right * fixes frontend test * make add panel actions accessible and rewrite test using RTLpull/35681/head
parent
423474325a
commit
6ee2f1fe3e
@ -1,24 +1,29 @@ |
||||
import React from 'react'; |
||||
import { shallow } from 'enzyme'; |
||||
import { render, screen } from '@testing-library/react'; |
||||
import { AddPanelWidgetUnconnected as AddPanelWidget, Props } from './AddPanelWidget'; |
||||
import { DashboardModel, PanelModel } from '../../state'; |
||||
|
||||
const setup = (propOverrides?: object) => { |
||||
const getTestContext = (propOverrides?: object) => { |
||||
const props: Props = { |
||||
dashboard: {} as DashboardModel, |
||||
panel: {} as PanelModel, |
||||
addPanel: jest.fn() as any, |
||||
}; |
||||
|
||||
Object.assign(props, propOverrides); |
||||
|
||||
return shallow(<AddPanelWidget {...props} />); |
||||
return render(<AddPanelWidget {...props} />); |
||||
}; |
||||
|
||||
describe('Render', () => { |
||||
it('should render component', () => { |
||||
const wrapper = setup(); |
||||
describe('AddPanelWidget', () => { |
||||
it('should render component without error', () => { |
||||
expect(() => { |
||||
getTestContext(); |
||||
}); |
||||
}); |
||||
|
||||
expect(wrapper).toMatchSnapshot(); |
||||
it('should render the add panel actions', () => { |
||||
getTestContext(); |
||||
expect(screen.getByText(/Add an empty panel/i)).toBeInTheDocument(); |
||||
expect(screen.getByText(/Add a new row/i)).toBeInTheDocument(); |
||||
expect(screen.getByText(/Add a panel from the panel library/i)).toBeInTheDocument(); |
||||
}); |
||||
}); |
||||
|
@ -1,68 +0,0 @@ |
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
||||
exports[`Render should render component 1`] = ` |
||||
<div |
||||
className="css-1q8dxo2" |
||||
> |
||||
<div |
||||
className="panel-container css-e4b3m6" |
||||
> |
||||
<AddPanelWidgetHandle |
||||
onCancel={[Function]} |
||||
styles={ |
||||
Object { |
||||
"actionsRow": "css-1j3dhm4", |
||||
"actionsWrapper": "css-gxxmom", |
||||
"backButton": "css-1cdxa9p", |
||||
"callToAction": "css-e4b3m6", |
||||
"headerRow": "css-3sdqvi", |
||||
"noMargin": "css-u023fv", |
||||
"wrapper": "css-1q8dxo2", |
||||
} |
||||
} |
||||
> |
||||
Add panel |
||||
</AddPanelWidgetHandle> |
||||
<div |
||||
className="css-gxxmom" |
||||
> |
||||
<div |
||||
className="css-1j3dhm4" |
||||
> |
||||
<div |
||||
aria-label="Add new panel" |
||||
onClick={[Function]} |
||||
> |
||||
<Icon |
||||
name="file-blank" |
||||
size="xl" |
||||
/> |
||||
Add an empty panel |
||||
</div> |
||||
<div |
||||
onClick={[Function]} |
||||
> |
||||
<Icon |
||||
name="wrap-text" |
||||
size="xl" |
||||
/> |
||||
Add a new row |
||||
</div> |
||||
</div> |
||||
<div |
||||
className="css-1j3dhm4" |
||||
> |
||||
<div |
||||
onClick={[Function]} |
||||
> |
||||
<Icon |
||||
name="book-open" |
||||
size="xl" |
||||
/> |
||||
Add a panel from the panel library |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
`; |
Loading…
Reference in new issue