Repository navigation
test(android): cover bottom-bar behavior state machine (#86) - #410
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 takesmax(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/elsechain; no timing, token, or logic change.Why
#354 landed the feature on
prototype-scroll-navbarwith 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 tomain.Tests
BottomBarBehaviorTest— 9 cases (storage resolution + round-trip, the collapse decision, the fraction composition across all branches)../gradlew testFullDebugUnitTest --tests com.noop.ui.BottomBarBehaviorTestgreen; full-modulecompileFullDebugKotlinclean.Scope
Android only. The iOS twin composes collapse imperatively via
withAnimationstate transitions (not a single expression) and itsStrandTestsdon't run in CI (app-buildis compile-only), so an iOS extraction is a separate fast-follow rather than a byte-identical twin here. UI-behavior parity, not code parity.