Skip to content

test: cover dynamically updated closeOnEsc prop - #576

Merged
pradel merged 1 commit into
masterfrom
test/dynamic-close-on-esc
Sep 24, 2026
Merged

pradel merged 1 commit into
masterfrom
test/dynamic-close-on-esc

Conversation

@pradel

@pradel pradel commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Closes #504.

The bug (a stale closeOnEsc closure captured by the document keydown listener) shared its root cause with #524 and was fixed in #573: the listener is now registered in an effect that depends on closeOnEsc, so it always uses the latest prop value.

This PR adds regression tests that lock the behavior in:

  • closeOnEsc updated from true to false while the modal is open does not close on esc.
  • closeOnEsc updated from false to true while the modal is open closes on esc.

Both pass on master and fail when the #573 source fix is reverted.

The stale closeOnEsc closure was fixed in #573; add regression tests
that toggle closeOnEsc while the modal is open and assert the esc key
behavior follows the latest prop value.

Closes #504
@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.69%. Comparing base (78a46ea) to head (4645957).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #576   +/-   ##
=======================================
  Coverage   80.69%   80.69%           
=======================================
  Files           7        7           
  Lines         202      202           
  Branches       74       74           
=======================================
  Hits          163      163           
  Misses         29       29           
  Partials       10       10           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pradel
pradel merged commit b69f310 into master Sep 24, 2026
3 checks passed
@pradel
pradel deleted the test/dynamic-close-on-esc branch September 24, 2026 17:44
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.

Modal does not work with dynamically set closeOnEsc prop

1 participant