mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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": [
|
"packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx:4199795290": [
|
||||||
[0, 19, 13, "RegExp match", "2409514259"]
|
[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": [
|
"packages/grafana-ui/src/components/FormField/FormField.test.tsx:3429087660": [
|
||||||
[0, 19, 13, "RegExp match", "2409514259"]
|
[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 React from 'react';
|
||||||
|
|
||||||
import { createTheme } from '@grafana/data';
|
import { createTheme } from '@grafana/data';
|
||||||
|
|
||||||
import { ColorSwatch } from './ColorSwatch';
|
|
||||||
import { NamedColorsPalette } from './NamedColorsPalette';
|
import { NamedColorsPalette } from './NamedColorsPalette';
|
||||||
|
|
||||||
describe('NamedColorsPalette', () => {
|
describe('NamedColorsPalette', () => {
|
||||||
@ -12,16 +11,9 @@ describe('NamedColorsPalette', () => {
|
|||||||
const selectedShade = greenHue.shades[2];
|
const selectedShade = greenHue.shades[2];
|
||||||
|
|
||||||
describe('theme support for named colors', () => {
|
describe('theme support for named colors', () => {
|
||||||
let wrapper: ReactWrapper, selectedSwatch;
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
wrapper.unmount();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render provided color variant specific for theme', () => {
|
it('should render provided color variant specific for theme', () => {
|
||||||
wrapper = mount(<NamedColorsPalette color={selectedShade.name} onChange={() => {}} />);
|
render(<NamedColorsPalette color={selectedShade.name} onChange={jest.fn()} />);
|
||||||
selectedSwatch = wrapper.find(ColorSwatch).findWhere((node) => node.key() === selectedShade.name);
|
expect(screen.getByRole('button', { name: `${selectedShade.name} color` })).toBeInTheDocument();
|
||||||
expect(selectedSwatch.prop('color')).toBe(selectedShade.color);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user