-
Notifications
You must be signed in to change notification settings - Fork 18
Attach a stable testid to default baseElement #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
Merged
sheremet-va
merged 18 commits into
vitest-community:main
from
nizans:fix/stable-base-element-selector
Jan 22, 2026
Merged
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5dfb1cc
Attach a stable testid to default baseElement
nizans f879d0e
Attach unique id per test and respect user custom testid attribute
nizans 8ec9a70
move vi.mock to top
nizans ff71a83
faster tests
nizans 1e019ac
remove ComponentThatChanges fixture and related test
nizans daa8e4c
remove unnecessary setTimeout in default testid selector test
nizans b671050
add prod test
nizans 667f3da
update @vitest/utils 4.0.17
nizans d50491a
fix: prevent overriding existing testid attribute in render function
nizans 1af14c8
refactor: remove unnecessary mock for @vitest/utils/helpers
nizans e8dae39
fix: add unique testid attribute to container in render function
nizans 7de6892
refactor: update test descriptions for clarity on unique testid usage
nizans 7ce7699
fix: use server-configured testid attribute for consistency in render…
nizans b0e7997
refactor: remove unused React import from render tests
nizans a2a5482
test: add tests for unique testid attribute handling and update vites…
nizans 71cd052
refactor: remove unnecessary blank line in render-selector tests
nizans 24f907f
fix: ensure testId attribute is set for baseElement and container in …
nizans c54a854
fix: ensure testId attributes are set for stability in render function
nizans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import React from 'react' | ||
| import type { JSX } from 'react/jsx-runtime' | ||
|
|
||
| export function ComponentThatChanges({ | ||
| timeout = 1500, | ||
|
sheremet-va marked this conversation as resolved.
Outdated
|
||
| }: { | ||
| timeout?: number | ||
| }): JSX.Element { | ||
| const [show, setShow] = React.useState(false) | ||
|
|
||
| React.useEffect(() => { | ||
| const timer = setTimeout(() => setShow(true), timeout) | ||
| return () => clearTimeout(timer) | ||
| }, [timeout]) | ||
|
|
||
| return <div>{show ? 'Hello Vitest!' : 'Loading...'}</div> | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.