Skip to content

test(android): cover bottom-bar behavior state machine (#86) - #410

Merged
ryanbr merged 1 commit into
prototype-scroll-navbarfrom
test/bottom-bar-behavior-logic
Jul 13, 2026
Merged

ryanbr merged 1 commit into
prototype-scroll-navbarfrom
test/bottom-bar-behavior-logic

Conversation

@ryanbr

@ryanbr ryanbr commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

Follow-up to #354. Extracts the two pure decisions from AppRoot's inline scroll-reactive bottom-bar collapse composition into testable top-level functions and adds coverage:

  • isBarEffectivelyCollapsed(behavior, reactiveCollapsed) — COMPACT always collapsed, EXPANDED never, REACTIVE follows the live scroll flag.
  • resolveBarCollapse(behavior, reduceMotion, reactiveCollapsed, precompression, settled) — the 0..1 fraction: Reduce Motion snaps to 0/1, a non-reactive mode rides the eased settle, REACTIVE-while-collapsed takes max(precompression, settled) (drift never regresses below the settle), REACTIVE-while-expanding follows precompression until it drops to 0.

Behavior-preserving — the composable now calls these functions instead of the inline if/else chain; no timing, token, or logic change.

Why

#354 landed the feature on prototype-scroll-navbar with the Android unit tests checklist box unchecked — the collapse state machine (noise gate, Drag-source-only expand, pre-compression → threshold settle) had zero tests on either platform. This is the test gate before the feature promotes to main.

Tests

BottomBarBehaviorTest — 9 cases (storage resolution + round-trip, the collapse decision, the fraction composition across all branches). ./gradlew testFullDebugUnitTest --tests com.noop.ui.BottomBarBehaviorTest green; full-module compileFullDebugKotlin clean.

Scope

Android only. The iOS twin composes collapse imperatively via withAnimation state transitions (not a single expression) and its StrandTests don't run in CI (app-build is compile-only), so an iOS extraction is a separate fast-follow rather than a byte-identical twin here. UI-behavior parity, not code parity.

Extract the two pure decisions from AppRoot's inline collapse composition into
testable top-level functions — isBarEffectivelyCollapsed() and
resolveBarCollapse() — and add BottomBarBehaviorTest. Behavior-preserving: the
composable now calls the extracted functions instead of the inline if/else chain.

Covers storage-string resolution (unknown/null -> REACTIVE, round-trip), the
COMPACT-always / EXPANDED-never / REACTIVE-follows-flag collapse decision, and
the fraction composition (Reduce Motion snaps to 0/1, non-reactive rides the
settle, reactive-collapsed takes max(precompression, settle), reactive-expanding
follows precompression then settle). 9 tests, testFullDebugUnitTest green.

Follows up #354: that PR left the Android-unit-tests box unchecked; this is the
test gate before the feature promotes from prototype-scroll-navbar to main.
@ryanbr
ryanbr merged commit de413b4 into prototype-scroll-navbar Jul 13, 2026
@ryanbr
ryanbr deleted the test/bottom-bar-behavior-logic branch July 13, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant