@@ -2,26 +2,21 @@ import { describe, it } from "@jest/globals";
2
2
import { fireEvent , render } from "@testing-library/react" ;
3
3
import { useState } from "react" ;
4
4
5
- import { ColorControl , PopoverColorChannels } from ".." ;
5
+ import { ColorControl } from ".." ;
6
6
7
7
describe ( "Color Control" , ( ) => {
8
8
it ( "Correct rendering and unmount" , ( ) => {
9
- const screen = render ( < ColorControl popover = { < PopoverColorChannels /> } /> ) ;
9
+ const screen = render ( < ColorControl label = "Background" /> ) ;
10
10
11
+ expect ( screen . getByText ( "Background" ) ) . toBeInTheDocument ( ) ;
11
12
expect ( ( ) => screen . unmount ( ) ) . not . toThrow ( ) ;
12
13
} ) ;
13
14
14
15
it ( "Should update value on change input" , ( ) => {
15
16
function Render ( ) {
16
17
const [ value , setValue ] = useState ( "#000" ) ;
17
18
18
- return (
19
- < ColorControl
20
- popover = { < PopoverColorChannels /> }
21
- sourceColor = { value }
22
- onChange = { ( value ) => setValue ( value ) }
23
- />
24
- ) ;
19
+ return < ColorControl sourceColor = { value } onChange = { ( value ) => setValue ( value ) } /> ;
25
20
}
26
21
27
22
const screen = render ( < Render /> ) ;
@@ -35,8 +30,8 @@ describe("Color Control", () => {
35
30
} ) ;
36
31
37
32
it ( "Should show popover color channels" , ( ) => {
38
- const screen = render ( < ColorControl popover = { < PopoverColorChannels /> } /> ) ;
39
- const buttonSettings = screen . getByLabelText ( "settings button") ;
33
+ const screen = render ( < ColorControl /> ) ;
34
+ const [ buttonSettings ] = screen . getAllByLabelText ( "picker button") ;
40
35
41
36
fireEvent . click ( buttonSettings ) ;
42
37
0 commit comments