Add explicit header dropdown layout types

This commit is contained in:
Joe Julian
2026-04-08 23:19:04 -07:00
parent 74a2bbdc92
commit 0a9201e0d1
3 changed files with 133 additions and 49 deletions
+36
View File
@@ -391,6 +391,42 @@ func TestAnchoredMenuOriginXClampsToVisibleContainer(t *testing.T) {
}
}
func TestHeaderActionMetricsComputeTriggerAnchors(t *testing.T) {
t.Parallel()
metrics := headerActionMetrics{
RowOriginX: 24,
Spacing: 8,
RowDims: layout.Dimensions{Size: image.Pt(180, 40)},
SyncDims: layout.Dimensions{Size: image.Pt(52, 40)},
LockDims: layout.Dimensions{Size: image.Pt(44, 40)},
MainDims: layout.Dimensions{Size: image.Pt(36, 40)},
}
if got := metrics.syncAnchor(); got != (dropdownAnchor{TriggerRightX: 76, TriggerBottomY: 40}) {
t.Fatalf("metrics.syncAnchor() = %+v, want right=76 bottom=40", got)
}
if got := metrics.mainAnchor(); got != (dropdownAnchor{TriggerRightX: 172, TriggerBottomY: 40}) {
t.Fatalf("metrics.mainAnchor() = %+v, want right=172 bottom=40", got)
}
}
func TestDropdownSurfaceOriginKeepsMenusWithinVisibleArea(t *testing.T) {
t.Parallel()
surface := dropdownSurface{ContainerWidth: 320, LeftInset: 16, TopInset: 16}
anchor := dropdownAnchor{TriggerRightX: 300, TriggerBottomY: 42}
if got := surface.origin(anchor, 140); got != image.Pt(176, 58) {
t.Fatalf("surface.origin(anchor, 140) = %v, want (176,58)", got)
}
leftAnchor := dropdownAnchor{TriggerRightX: 36, TriggerBottomY: 42}
if got := surface.origin(leftAnchor, 120); got != image.Pt(16, 58) {
t.Fatalf("surface.origin(leftAnchor, 120) = %v, want (16,58)", got)
}
}
func TestUICurrentVaultSummary(t *testing.T) {
t.Parallel()