@@ -27,9 +27,9 @@ it('should render a basic stream chart', () => {
27
27
} )
28
28
29
29
describe ( 'layers' , ( ) => {
30
- const CustomLayer = ( ) => < g />
31
-
32
30
it ( 'should support custom layers' , ( ) => {
31
+ const CustomLayer = ( ) => < g />
32
+
33
33
const wrapper = mount (
34
34
< Stream < TestDatum > { ...commonProps } layers = { [ 'grid' , 'axes' , 'layers' , CustomLayer ] } />
35
35
)
@@ -103,6 +103,15 @@ describe('tooltip', () => {
103
103
expect ( layerData . id ) . toBe ( commonProps . keys [ 0 ] )
104
104
} )
105
105
106
+ it ( 'should allow to use a custom tooltip' , ( ) => {
107
+ const CustomTooltip = ( ) => < div />
108
+
109
+ const wrapper = mount ( < Stream < TestDatum > { ...commonProps } tooltip = { CustomTooltip } /> )
110
+
111
+ wrapper . find ( 'StreamLayer' ) . at ( 0 ) . find ( 'path' ) . simulate ( 'mouseEnter' )
112
+ expect ( wrapper . find ( CustomTooltip ) . exists ( ) ) . toBe ( true )
113
+ } )
114
+
106
115
it ( 'should have stack tooltip enabled by default' , ( ) => {
107
116
const wrapper = mount ( < Stream < TestDatum > { ...commonProps } /> )
108
117
@@ -131,6 +140,22 @@ describe('tooltip', () => {
131
140
} )
132
141
} )
133
142
143
+ it ( 'should allow to use a custom stack tooltip' , ( ) => {
144
+ const CustomStackTooltip = ( ) => < div />
145
+
146
+ const wrapper = mount (
147
+ < Stream < TestDatum > { ...commonProps } stackTooltip = { CustomStackTooltip } />
148
+ )
149
+
150
+ wrapper
151
+ . find ( 'StreamSlices' )
152
+ . find ( 'StreamSlicesItem' )
153
+ . at ( 0 )
154
+ . find ( 'rect' )
155
+ . simulate ( 'mouseEnter' )
156
+ expect ( wrapper . find ( CustomStackTooltip ) . exists ( ) ) . toBe ( true )
157
+ } )
158
+
134
159
it ( 'should allow to disable stack tooltip' , ( ) => {
135
160
const wrapper = mount ( < Stream < TestDatum > { ...commonProps } enableStackTooltip = { false } /> )
136
161
0 commit comments