@@ -84,14 +84,13 @@ describe('time chart interactions', () => {
8484 it ( 'shows timestamp and decimal values only in the hovered chart tooltip' , ( ) => {
8585 const { instance } = makeChart ( 'one' )
8686 const store = createDashboardCursorStore ( )
87- const onReadout = vi . fn ( )
8887 const controller = bindTimeSeriesInteractions ( instance , {
8988 range,
9089 timeZone : 'America/Los_Angeles' ,
9190 cursorStore : store ,
9291 columnLabels : { } ,
9392 firstTime : time ,
94- onReadout,
93+ onReadout : ( ) => { } ,
9594 } )
9695 const option = controller . prepareOption ( {
9796 xAxis : { type : 'time' } ,
@@ -113,11 +112,10 @@ describe('time chart interactions', () => {
113112 expect ( tooltip . formatter ( params ) ) . toBe ( 'Sep 20, 17:00 PDT\nResolved: 71.63%' )
114113 store . getState ( ) . setCursor ( { owner : 'other' , group : `${ range . from } /${ range . to } ` , time } )
115114 expect ( tooltip . formatter ( params ) ) . toBe ( '' )
116- expect ( onReadout ) . toHaveBeenLastCalledWith ( expect . objectContaining ( { time } ) )
117115 controller . dispose ( )
118116 expect ( tooltip . formatter ( params ) ) . toBe ( '' )
119117 } )
120- it ( 'synchronizes by timestamp without feedback loops, isolates other ranges, and cleans up ' , ( ) => {
118+ it ( 'shares the hovered timestamp through the cursor store and clears it on leave ' , ( ) => {
121119 const store = createDashboardCursorStore ( )
122120 const first = makeChart ( 'one' )
123121 const second = makeChart ( 'two' )
@@ -128,7 +126,7 @@ describe('time chart interactions', () => {
128126 cursorStore : store ,
129127 columnLabels : { } ,
130128 firstTime : time ,
131- onReadout : vi . fn ( ) ,
129+ onReadout : ( ) => { } ,
132130 }
133131 const bindings = [
134132 bindTimeSeriesInteractions ( first . instance , config ) ,
@@ -140,44 +138,27 @@ describe('time chart interactions', () => {
140138 ]
141139 first . handlers . get ( 'updateAxisPointer' ) ?.( { axesInfo : [ { axisDim : 'x' , value : time } ] } )
142140 expect ( store . getState ( ) . cursor ?. owner ) . toBe ( 'one' )
143- expect ( second . chart . dispatchAction ) . toHaveBeenCalledTimes ( 1 )
144- expect ( second . chart . dispatchAction ) . toHaveBeenCalledWith ( {
145- type : 'updateAxisPointer' ,
146- x : time / 10000 ,
147- y : 110 ,
148- } )
149- expect ( third . chart . dispatchAction ) . not . toHaveBeenCalledWith (
150- expect . objectContaining ( { x : time / 10000 , type : 'updateAxisPointer' } )
151- )
152141 first . handlers . get ( 'hideTip' ) ?.( { } )
153142 expect ( store . getState ( ) . cursor ) . toBeNull ( )
154143 bindings . forEach ( ( binding ) => binding . dispose ( ) )
155- expect ( second . handlers . size ) . toBe ( 0 )
156- second . chart . dispatchAction . mockClear ( )
157- store . getState ( ) . setCursor ( { owner : 'other' , group : `${ range . from } /${ range . to } ` , time } )
158- expect ( second . chart . dispatchAction ) . not . toHaveBeenCalled ( )
159144 } )
160- it ( 'queries only after a meaningful completed brush, clears it, and ignores clicks' , ( ) => {
161- const { instance, handlers, chart } = makeChart ( 'one' )
162- const onZoom = vi . fn ( )
145+ it ( 'zooms only after a meaningful completed brush and ignores clicks' , ( ) => {
146+ const { instance, handlers } = makeChart ( 'one' )
147+ const zooms : unknown [ ] = [ ]
163148 const controller = bindTimeSeriesInteractions ( instance , {
164149 range,
165150 timeZone : 'UTC' ,
166151 cursorStore : createDashboardCursorStore ( ) ,
167152 columnLabels : { } ,
168153 firstTime : time ,
169- onReadout : vi . fn ( ) ,
170- onZoom,
154+ onReadout : ( ) => { } ,
155+ onZoom : ( zoom ) => zooms . push ( zoom ) ,
171156 } )
172157 expect ( handlers . has ( 'brush' ) ) . toBe ( false )
173158 handlers . get ( 'brushEnd' ) ?.( { areas : [ { coordRange : [ time , time + 3600000 ] , range : [ 30 , 31 ] } ] } )
174- expect ( onZoom ) . not . toHaveBeenCalled ( )
159+ expect ( zooms ) . toEqual ( [ ] )
175160 handlers . get ( 'brushEnd' ) ?.( { areas : [ { coordRange : [ time + 3600000 , time ] , range : [ 80 , 30 ] } ] } )
176- expect ( onZoom ) . toHaveBeenCalledExactlyOnceWith ( {
177- from : '2026-09-21T00:00:00.000Z' ,
178- to : '2026-09-21T01:00:00.000Z' ,
179- } )
180- expect ( chart . dispatchAction ) . toHaveBeenCalledWith ( { type : 'brush' , areas : [ ] } )
161+ expect ( zooms ) . toEqual ( [ { from : '2026-09-21T00:00:00.000Z' , to : '2026-09-21T01:00:00.000Z' } ] )
181162 controller . dispose ( )
182163 } )
183164} )
0 commit comments