Skip to content

Commit 5900fac

Browse files
committed
Fix correlation hover tooltip sync
1 parent ef25c12 commit 5900fac

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

app/static/js/correlation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ function _setupCorrelationTooltip(overlay, octx) {
935935
if (st.segment && st.segment.length > 0) {
936936
var nearestSeg = null, segDist = Infinity;
937937
for (var si = 0; si < st.segment.length; si++) {
938-
var sd = Math.abs(new Date(st.segment[si].timestamp).getTime() - hoverT);
938+
var sd = Math.abs(new Date(st.segment[si].timestamp).getTime() - tHover);
939939
if (sd < segDist) { segDist = sd; nearestSeg = st.segment[si]; }
940940
}
941941
if (nearestSeg && segDist < (st.tMax - st.tMin) * 0.05) {

tests/e2e/test_segment_utilization.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,29 @@ def test_correlation_legend_has_segment_entries(self, fritzbox_page):
409409
text = legend.text_content()
410410
assert "Segment" in text, f"Legend should mention Segment, got: {text}"
411411

412+
def test_correlation_hover_shows_tooltip_and_highlights_timeline(self, fritzbox_page):
413+
"""Hovering the correlation chart should keep tooltip and timeline sync working with segment data."""
414+
errors = []
415+
fritzbox_page.on("pageerror", lambda err: errors.append(str(err)))
416+
fritzbox_page.locator('a.nav-item[data-view="correlation"]').click()
417+
fritzbox_page.wait_for_timeout(3000)
418+
419+
overlay = fritzbox_page.locator("canvas#correlation-overlay")
420+
box = overlay.bounding_box()
421+
assert box, "Correlation overlay should be present for hover interactions"
422+
423+
fritzbox_page.mouse.move(box["x"] + box["width"] * 0.55, box["y"] + box["height"] * 0.45)
424+
fritzbox_page.wait_for_timeout(400)
425+
426+
tooltip = fritzbox_page.locator("#correlation-tooltip")
427+
assert tooltip.is_visible(), "Correlation tooltip should appear on hover"
428+
429+
highlighted = fritzbox_page.locator("#correlation-tbody tr.corr-highlight")
430+
assert highlighted.count() > 0, "Unified timeline should highlight at least one hovered entry"
431+
432+
hover_errors = [e for e in errors if "hoverT" in e or "undefined" in e.lower()]
433+
assert len(hover_errors) == 0, f"Correlation hover should not raise JS errors: {hover_errors}"
434+
412435

413436
# ── View Div Presence ──
414437

0 commit comments

Comments
 (0)