mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 01:16:31 -06:00
Add simple test for the ColorPicker
This commit is contained in:
parent
96285c4f56
commit
dfb2dd2500
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { ColorPicker } from './ColorPicker';
|
||||
import { ColorPickerTrigger } from './ColorPickerTrigger';
|
||||
|
||||
describe('ColorPicker', () => {
|
||||
it('renders ColorPickerTrigger component by default', () => {
|
||||
expect(
|
||||
renderer.create(<ColorPicker color="#EAB839" onChange={() => {}} />).root.findByType(ColorPickerTrigger)
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it('renders custom trigger when supplied', () => {
|
||||
const div = renderer
|
||||
.create(
|
||||
<ColorPicker color="#EAB839" onChange={() => {}}>
|
||||
{() => <div>Custom trigger</div>}
|
||||
</ColorPicker>
|
||||
)
|
||||
.root.findByType('div');
|
||||
expect(div.children[0]).toBe('Custom trigger');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user