File tree 2 files changed +28
-33
lines changed
app/javascript/components/tooltip
2 files changed +28
-33
lines changed Original file line number Diff line number Diff line change
1
+ import { mountedComponent , screen } from "../../test-utils" ;
2
+
3
+ import Tooltip from "./component" ;
4
+
5
+ describe ( "components/tooltip" , ( ) => {
6
+ it ( "renders tooltip" , ( ) => {
7
+ const TooltipComponent = ( ) => (
8
+ < Tooltip title = "wrapper content" data-testid = "wrapper-content" >
9
+ < div > wrapped children</ div >
10
+ </ Tooltip >
11
+ ) ;
12
+
13
+ mountedComponent ( < TooltipComponent /> ) ;
14
+ expect ( screen . getByText ( / w r a p p e d c h i l d r e n / i) ) . toBeInTheDocument ( ) ;
15
+ } ) ;
16
+
17
+ it ( "does not render tooltip without title" , ( ) => {
18
+ const TooltipComponent = ( ) => (
19
+ < Tooltip title = "" >
20
+ < div > wrapped children</ div >
21
+ </ Tooltip >
22
+ ) ;
23
+
24
+ mountedComponent ( < TooltipComponent /> ) ;
25
+ expect ( screen . getByText ( / w r a p p e d c h i l d r e n / i) ) . toBeInTheDocument ( ) ;
26
+ expect ( screen . queryAllByRole ( "tooltip" ) ) . toHaveLength ( 0 ) ;
27
+ } ) ;
28
+ } ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments