Skip to content

test(ensemble): cover Page header listeners and ListViewCore scroll rebind#2243

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/missing-test-coverage-dddf
Draft

test(ensemble): cover Page header listeners and ListViewCore scroll rebind#2243
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/missing-test-coverage-dddf

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented May 30, 2026

Summary

Adds regression tests for two recent production fixes that shipped without full test coverage.

Risky behavior now covered

  • Page header storage listeners (2c45e427): PageState previously registered three duplicate ModelChangeEvent listeners for titleBarHeight storage updates and never cancelled periodic poll timers on dispose. Tests assert a single stored subscription is created and that poll timers are cancelled cleanly when the page is removed.
  • ListViewCore scroll controller sync (c792a8a6): When a caller-provided ScrollController is swapped at runtime, ListViewCore must rebind its internal Scrollable (not only the public ListViewController). A widget test verifies the Scrollable.controller tracks the new external controller.

Test files added/updated

  • modules/ensemble/test/widget/page_header_storage_listeners_test.dart (new)
  • modules/ensemble/lib/framework/view/page.dart@visibleForTesting getters for listener/timer state (no behavior change)
  • modules/ensemble/test/widget/list_view_test.dart — external scroll controller swap case

Why these tests materially reduce regression risk

  • Header storage listeners run on every page with dynamic AppBar height; duplicate subscriptions multiplied rebuild work and undisposed timers could leak callbacks across navigations.
  • Scroll controller desync between ListViewController and ListViewCore breaks programmatic scroll APIs and footer handoff; the new test complements the existing footer-scope regression test.

Validation

cd modules/ensemble
flutter test test/widget/page_header_storage_listeners_test.dart
flutter test test/widget/list_view_test.dart --plain-name "ListViewCore rebinds when external scroll controller changes"

Both new tests pass. Note: the existing footer-scope ListView test appears flaky in this VM environment (also fails on main); not introduced by this PR.

Open in Web View Automation 

cursoragent and others added 2 commits May 30, 2026 10:10
Add widget tests for the fix that deduped titleBarHeight storage event
subscriptions and cancelled periodic poll timers on PageState dispose.

Expose @VisibleForTesting getters so tests can assert a single stored
subscription and that poll timers are torn down without leaking callbacks.

Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
Assert ListViewCore rebinds its Scrollable when the parent ListView
retargets to a different caller-provided controller, guarding the
didUpdateWidget sync added in the ListViewCore scroll fix.

Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
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