Add comprehensive ViewTransition component unit tests#36515
Open
vansszh wants to merge 1 commit into
Open
Conversation
Add three new test files covering ViewTransition component behavior: - ReactDOMViewTransitionName-test.js: Tests for name resolution (auto-generated names, explicit names, name stability across re-renders, sibling and nested ViewTransitions, conditional rendering, mount/unmount cycles) - ReactDOMViewTransitionClass-test.js: Tests for className resolution (string classes, object classes with transition types, 'none' precedence, 'auto' behavior, multiple matching types, default fallback, event class overrides) - ReactDOMViewTransitionWarnings-test.js: Tests for duplicate name warnings and edge cases (duplicate name detection, 'auto' name exemption, unnamed exemption, unmount-before-mount, warn-once behavior, rapid mount/unmount, list operations, Suspense integration, key changes, deeply nested ViewTransitions, Fragment/memo/forwardRef children) The existing test coverage for ViewTransition is minimal (6 tests in ReactDOMViewTransition-test.js) relative to the 35KB+ of source code in ReactFiberCommitViewTransitions.js and ReactFiberViewTransitionComponent.js. These tests improve coverage of the component's core behaviors.
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
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.
Summary
Add three new test files with comprehensive unit tests for the
<ViewTransition>component, covering areas that currently lack test coverage.The existing test coverage is minimal (6 tests in
ReactDOMViewTransition-test.js, 4 inReactDOMFizzViewTransition-test.js, 1 inViewTransitionReactServer-test.js) relative to the 35KB+ of source code inReactFiberCommitViewTransitions.jsandReactFiberViewTransitionComponent.js.New Test Files
ReactDOMViewTransitionName-test.js(9 tests)'auto'ReactDOMViewTransitionClass-test.js(14 tests)defaultkey as class'none'class which suppresses transition'none'in object class taking precedence'auto'class'auto'nullifies the classReactDOMViewTransitionWarnings-test.js(6 warning tests + 13 edge case tests)'auto'name duplicatesHow did you test this change?
These are test-only additions. They follow the same patterns as the existing
ReactDOMViewTransition-test.jstest file (same mocking approach fordocument.startViewTransition,getBoundingClientRect,getAnimations, etc.).