Skip to content

Customize time travelling on implicit event loop progression #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stroiman opened this issue Feb 27, 2025 · 0 comments
Open

Customize time travelling on implicit event loop progression #44

stroiman opened this issue Feb 27, 2025 · 0 comments

Comments

@stroiman
Copy link
Member

When client script is executed, either because of a <script> tag, or executing an event handler/timeout handler, all immediately enqueued items are implicitly executed. I.e., all timeouts registered for the current simulated point in time.

For an application might have animations, the events may be registered in the future, and will require tests to explicitly advance time, either by a specific amount, calling Clock.Advance, or just run all scheduled handlers calling Clock.RunAll.

To keep test code focused on behaviour, such calls become noise, and a way to handle it would be to allow the test code to specify an amount of time to implicitly increment, or implicitly run all enqueued tasks.

It is more likely that test code doesn't care about the amount of time that passes, and only in the rarer cases when you want to explicitly verify debounce/throttle behaviour, that the test need 100% control over simulated time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant