diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx index 78350a9108a..d3cf04a4b71 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.test.tsx @@ -1,3 +1,5 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import React from 'react'; import renderer from 'react-test-renderer'; @@ -11,6 +13,17 @@ describe('ColorPicker', () => { ).toBeTruthy(); }); + it('should not have buttons with default submit type', async () => { + render( {}} />); + const mainButton = screen.getAllByRole('button'); + expect(mainButton.length).toBe(1); + mainButton.forEach((button) => expect(button).toHaveAttribute('type', 'button')); + await userEvent.click(mainButton[0]); + const buttons = screen.getAllByRole('button'); + expect(buttons.length).toBe(35); + buttons.forEach((button) => expect(button).toHaveAttribute('type', 'button')); + }); + it('renders custom trigger when supplied', () => { const div = renderer .create( diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx index 63c463178ae..110f0f30dfc 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx @@ -100,7 +100,7 @@ class UnThemedColorPickerPopover extends Comp <> {Object.keys(customPickers).map((key) => { return ( - ); @@ -120,10 +120,10 @@ class UnThemedColorPickerPopover extends Comp */}
- - {this.renderCustomPickerTabs()} diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx index 679346817a5..e63572c5aca 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorSwatch.tsx @@ -34,7 +34,7 @@ export const ColorSwatch = React.forwardRef( return (
{hasLabel && {label}} -
); }