mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 20:43:26 -06:00
Convert NamedColorsPalette
tests to RTL (#49064)
This commit is contained in:
parent
d477394d6c
commit
3b0cd8b6f1
@ -8,9 +8,6 @@ exports[`no enzyme tests`] = {
|
||||
"packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx:4199795290": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.test.tsx:3311646309": [
|
||||
[0, 31, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/FormField/FormField.test.tsx:3429087660": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { mount, ReactWrapper } from 'enzyme';
|
||||
import { screen, render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { createTheme } from '@grafana/data';
|
||||
|
||||
import { ColorSwatch } from './ColorSwatch';
|
||||
import { NamedColorsPalette } from './NamedColorsPalette';
|
||||
|
||||
describe('NamedColorsPalette', () => {
|
||||
@ -12,16 +11,9 @@ describe('NamedColorsPalette', () => {
|
||||
const selectedShade = greenHue.shades[2];
|
||||
|
||||
describe('theme support for named colors', () => {
|
||||
let wrapper: ReactWrapper, selectedSwatch;
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('should render provided color variant specific for theme', () => {
|
||||
wrapper = mount(<NamedColorsPalette color={selectedShade.name} onChange={() => {}} />);
|
||||
selectedSwatch = wrapper.find(ColorSwatch).findWhere((node) => node.key() === selectedShade.name);
|
||||
expect(selectedSwatch.prop('color')).toBe(selectedShade.color);
|
||||
render(<NamedColorsPalette color={selectedShade.name} onChange={jest.fn()} />);
|
||||
expect(screen.getByRole('button', { name: `${selectedShade.name} color` })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user