Skip to content
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

test: render with events utility refactoring #554

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

peterpeterparker
Copy link
Member

Motivation

Using an $on callback for testing is deprecated in Svelte v5 (PR #548). Instead, we will now use the events option of render, which itself will eventually be replaced by the library. To minimize changes in the Svelte v5 PR, we refactored the test to use a utility function that handles rendering and event binding.

Changes

  • Introduce and use renderWithEvents utilitiy.

src/tests/utils/render.test-utils.ts Outdated Show resolved Hide resolved
src/tests/utils/render.test-utils.ts Show resolved Hide resolved
@peterpeterparker
Copy link
Member Author

So the events that we are passing now are at the same time new and already deprecated?

Yes, kind of. We do it this way so we don’t have to migrate all components at once. It reduces the number of changes needed for the upgrade by solely adapting few tests.

Is that TODO specific to that one test or would it apply to all tests?

Once this PR is merged and rebased into the Svelte v5 branch, only one TODO will remain.

@peterpeterparker peterpeterparker merged commit e4ada9a into main Dec 17, 2024
9 checks passed
@peterpeterparker peterpeterparker deleted the feat/render-with-events branch December 17, 2024 08:38
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.

2 participants