-
Notifications
You must be signed in to change notification settings - Fork 8
feat: transition directive wrapper for test purpose #573
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
Merged
Conversation
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
This was referenced Feb 4, 2025
dskloetd
approved these changes
Feb 4, 2025
github-merge-queue bot
pushed a commit
to dfinity/nns-dapp
that referenced
this pull request
Feb 4, 2025
# Motivation We have to disable the transition for testing purposes, as Svelte v5 introduces breaking changes in how it handles transitions. It now uses the Web Animations API, which is not available in JSDOM or Happy-DOM. While testing this new setup against `main`, we discovered that disabling animations causes Svelte to use the `ResizeObserver`, which is also an API not currently available in JSDOM or Happy-DOM (see this [CI job](https://github.com/dfinity/nns-dapp/actions/runs/13131513035/job/36637485021)). That is why we are mocking this API. Worth noting, we would need to mock it anyway to integrate Svelte v5. # References - dfinity/gix-components#573 - dfinity/gix-components#573 # Changes <!-- List the changes that have been developed --> # Tests After mocking the `ResizeObserver`, the CI passed for the branch (see PR #6336) that was use to assert this new feature. Signed-off-by: David Dal Busco <[email protected]>
peterpeterparker
added a commit
that referenced
this pull request
Feb 4, 2025
# Motivation Implements the transition directives wrappers provided in #573 for the transition that lead the [CI](https://github.com/dfinity/nns-dapp/actions/runs/13129931873/job/36632946426) to fail in the NNS dapp Svelte v5 branch. # Changes - Instead of using `svelte/transition`, use the wrappers that skips the transitions for testing purposes # Tests I asserted this changes has no impact on the test suite of NNS dapp by integrating a manual package and running the CI successfully in dfinity/nns-dapp#6336. We will have to mock the `ResizeObserver` though but, that's something we need for Svelte v5 testing anyway dfinity/nns-dapp#6337
This was referenced Feb 10, 2025
peterpeterparker
added a commit
that referenced
this pull request
Feb 10, 2025
# Motivation Few params types were not correctly inherited in #573. # Changes - Use `FlyParams` for "fly" and `ScaleParams` for "scale" instead of `FadeParams`.
peterpeterparker
added a commit
that referenced
this pull request
Feb 10, 2025
# Motivation Provide a wrapper for the "slide" transition, similarly as those which were provided in #573. Needed in OISY for Svelte v5 - i.e. looks like we will have to use those wrappers in consuming dApps as well. The PR also # Changes - Add `testSafeSlide`.
This was referenced Feb 11, 2025
github-merge-queue bot
pushed a commit
to dfinity/nns-dapp
that referenced
this pull request
Feb 11, 2025
# Motivation Svelte v5 requires the web animation API which is not supported in emulated testing environment. That is why we added some "test safe transition directive" to Gix components (see PR dfinity/gix-components#573) and why we are using those transitions in this PR. # Notes - Relates to the Svelte v5 migration PR #6020 - Requires Gix-cmp bumped in PR #6394 # Changes - Use `testSafe...` directives instead of directly using transition of Svelte Signed-off-by: David Dal Busco <[email protected]>
peterpeterparker
added a commit
that referenced
this pull request
Feb 12, 2025
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.
Motivation
Svelte requires require the web animations API, and neither jsdom nor happy-dom implements it.
While in Gix-cmp or OISY we are able to apply some mocks in the configuration, this is insuffisent for the existing large test suite of NNS dapp for which many tests fail, when migrating to Svelte v5, with the error:
As suggested in one of the related issues (see linked below), we can overcome the problem by disabling animations in test mode.
References
CI issues
Changes
Tests
Errors do not happen anymore in NNS dapp - Svelte v5 wip branch running in the CI.