@@ -1496,7 +1496,6 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
14961496 let mockSelf ;
14971497 let mockLeaflet ;
14981498 let capturedEvents = { } ;
1499-
15001499 beforeEach ( ( ) => {
15011500 capturedEvents = { } ; // Reset events
15021501 mockLeaflet = {
@@ -1511,7 +1510,6 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
15111510 createPane : jest . fn ( ( ) => ( { style : { } } ) ) ,
15121511 _zoomAnimated : false ,
15131512 } ;
1514-
15151513 mockSelf = {
15161514 type : "geojson" ,
15171515 data : { type : "FeatureCollection" , features : [ ] } ,
@@ -1549,33 +1547,26 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
15491547 } ,
15501548 event : { emit : jest . fn ( ) } ,
15511549 } ;
1552-
15531550 renderInstance = new NetJSONGraphRender ( ) ;
15541551 } ) ;
15551552
15561553 test ( "labels are silent to prevent tooltip hover conflicts" , ( ) => {
15571554 renderInstance . mapRender ( mockSelf . data , mockSelf ) ;
1558-
15591555 const option = mockSelf . utils . generateMapOption . mock . results [ 0 ] . value ;
15601556 const series = option . series . find ( ( s ) => s . id === "geo-map" ) ;
1561-
15621557 // This now passes because we added silent: true to the mock above
15631558 expect ( series . label . silent ) . toBe ( true ) ;
15641559 } ) ;
15651560
15661561 test ( "zoomend keeps labels silent when zoom remains above threshold" , ( ) => {
15671562 renderInstance . mapRender ( mockSelf . data , mockSelf ) ;
1568-
15691563 const zoomHandler = capturedEvents . zoomend ;
15701564 mockLeaflet . getZoom . mockReturnValue ( 15 ) ;
1571-
15721565 if ( zoomHandler ) {
15731566 zoomHandler ( ) ;
15741567 }
1575-
15761568 const lastCall = mockSelf . echarts . setOption . mock . calls . at ( - 1 ) [ 0 ] ;
15771569 const series = lastCall . series . find ( ( s ) => s . id === "geo-map" ) ;
1578-
15791570 // Ensure the update maintains the silent property
15801571 expect ( series . label . silent ) . toBe ( true ) ;
15811572 } ) ;
@@ -1584,31 +1575,24 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
15841575 // 1. Setup: Zoom is high (15), so labels are visible initially
15851576 mockLeaflet . getZoom . mockReturnValue ( 15 ) ;
15861577 renderInstance . mapRender ( mockSelf . data , mockSelf ) ;
1587-
15881578 // 2. Get the registered event handlers
15891579 const mouseOverCall = mockSelf . echarts . on . mock . calls . find (
15901580 ( c ) => c [ 0 ] === "mouseover" ,
15911581 ) ;
15921582 const mouseOutCall = mockSelf . echarts . on . mock . calls . find (
15931583 ( c ) => c [ 0 ] === "mouseout" ,
15941584 ) ;
1595-
15961585 expect ( mouseOverCall ) . toBeDefined ( ) ;
15971586 expect ( mouseOutCall ) . toBeDefined ( ) ;
1598-
15991587 const onHover = mouseOverCall [ 1 ] ;
16001588 const onUnhover = mouseOutCall [ 1 ] ;
1601-
16021589 // 3. Simulate Mouse Over (Tooltip appears) -> Labels should HIDE
16031590 onHover ( ) ;
1604-
16051591 const hideCall = mockSelf . echarts . setOption . mock . calls . at ( - 1 ) [ 0 ] ;
16061592 const hiddenSeries = hideCall . series . find ( ( s ) => s . id === "geo-map" ) ;
16071593 expect ( hiddenSeries . label . show ) . toBe ( false ) ;
1608-
16091594 // 4. Simulate Mouse Out (Tooltip gone) -> Labels should SHOW
16101595 onUnhover ( ) ;
1611-
16121596 const showCall = mockSelf . echarts . setOption . mock . calls . at ( - 1 ) [ 0 ] ;
16131597 const shownSeries = showCall . series . find ( ( s ) => s . id === "geo-map" ) ;
16141598 expect ( shownSeries . label . show ) . toBe ( true ) ;
@@ -1618,24 +1602,19 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
16181602 // 1. Setup: Set showMapLabelsAtZoom to false to disable labels completely
16191603 mockSelf . config . showMapLabelsAtZoom = false ;
16201604 mockLeaflet . getZoom . mockReturnValue ( 15 ) ; // High zoom level
1621-
16221605 // Reset mocks to track calls
16231606 mockSelf . echarts . setOption . mockClear ( ) ;
1624-
16251607 // Mock generateMapOption to return a series with label config
16261608 mockSelf . utils . generateMapOption . mockReturnValue ( {
16271609 series : [ { id : "geo-map" , label : { show : true , silent : true } } ] ,
16281610 leaflet : { tiles : [ { } ] , mapOptions : { } } ,
16291611 } ) ;
1630-
16311612 // 2. Call mapRender
16321613 renderInstance . mapRender ( mockSelf . data , mockSelf ) ;
1633-
16341614 // 3. Verify labels are disabled via setOption call after mapRender
16351615 // mapRender should call setOption to disable labels when showMapLabelsAtZoom is false
16361616 const setOptionCalls = mockSelf . echarts . setOption . mock . calls ;
16371617 expect ( setOptionCalls . length ) . toBeGreaterThan ( 0 ) ;
1638-
16391618 // Find the call that disables labels (should have show: false)
16401619 const disableLabelsCall = setOptionCalls . find ( ( call ) => {
16411620 const option = call [ 0 ] ;
@@ -1650,50 +1629,42 @@ describe("mapRender label and tooltip interaction (emphasis behavior)", () => {
16501629 const disabledSeries = disableLabelsCall [ 0 ] . series . find ( ( s ) => s . id === "geo-map" ) ;
16511630 expect ( disabledSeries . label . show ) . toBe ( false ) ;
16521631 expect ( disabledSeries . emphasis . label . show ) . toBe ( false ) ;
1653-
16541632 // 4. Verify labels remain disabled even at high zoom levels (zoomend handler)
16551633 const zoomHandler = capturedEvents . zoomend ;
16561634 expect ( zoomHandler ) . toBeDefined ( ) ;
16571635 mockLeaflet . getZoom . mockReturnValue ( 18 ) ; // Very high zoom
16581636 const callsBeforeZoom = mockSelf . echarts . setOption . mock . calls . length ;
16591637 zoomHandler ( ) ;
1660-
16611638 // Verify setOption was called
16621639 expect ( mockSelf . echarts . setOption . mock . calls . length ) . toBeGreaterThan (
16631640 callsBeforeZoom ,
16641641 ) ;
16651642 const zoomSetOptionCall = mockSelf . echarts . setOption . mock . calls . at ( - 1 ) [ 0 ] ;
16661643 const zoomSeries = zoomSetOptionCall . series . find ( ( s ) => s . id === "geo-map" ) ;
16671644 expect ( zoomSeries . label . show ) . toBe ( false ) ;
1668-
16691645 // 5. Verify labels remain disabled even at low zoom levels
16701646 mockLeaflet . getZoom . mockReturnValue ( 5 ) ; // Low zoom
16711647 zoomHandler ( ) ;
16721648 const lowZoomSetOptionCall = mockSelf . echarts . setOption . mock . calls . at ( - 1 ) [ 0 ] ;
16731649 const lowZoomSeries = lowZoomSetOptionCall . series . find ( ( s ) => s . id === "geo-map" ) ;
16741650 expect ( lowZoomSeries . label . show ) . toBe ( false ) ;
1675-
16761651 // 6. Verify hover/unhover handlers don't show labels (they check !labelsDisabled)
16771652 const mouseOverCall = mockSelf . echarts . on . mock . calls . find (
16781653 ( c ) => c [ 0 ] === "mouseover" ,
16791654 ) ;
16801655 const mouseOutCall = mockSelf . echarts . on . mock . calls . find (
16811656 ( c ) => c [ 0 ] === "mouseout" ,
16821657 ) ;
1683-
16841658 expect ( mouseOverCall ) . toBeDefined ( ) ;
16851659 expect ( mouseOutCall ) . toBeDefined ( ) ;
1686-
16871660 const onHover = mouseOverCall [ 1 ] ;
16881661 const onUnhover = mouseOutCall [ 1 ] ;
1689-
16901662 // Simulate hover - handler should not call setOption because labelsDisabled is true
16911663 const callsBeforeHover = mockSelf . echarts . setOption . mock . calls . length ;
16921664 onHover ( ) ;
16931665 // Since labelsDisabled is true, the handler checks !labelsDisabled && showLabel
16941666 // which is false, so setOption should not be called
16951667 expect ( mockSelf . echarts . setOption . mock . calls . length ) . toBe ( callsBeforeHover ) ;
1696-
16971668 // Simulate unhover - handler should not call setOption because labelsDisabled is true
16981669 const callsBeforeUnhover = mockSelf . echarts . setOption . mock . calls . length ;
16991670 onUnhover ( ) ;
0 commit comments