-
-
Notifications
You must be signed in to change notification settings - Fork 114
docs(cn): translate guide/browser/assertion-api #832
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
NoiseFan
merged 3 commits into
vitest-dev:dev
from
zero-years:docs-guide/browser/assertion
Dec 8, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -304,12 +304,12 @@ await expect.element( | |
| function toBeInViewport(options: { ratio?: number }): Promise<void> | ||
| ``` | ||
|
|
||
| This allows you to check if an element is currently in viewport with [IntersectionObserver API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API). | ||
| 允许你通过 [IntersectionObserver API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) 检查元素是否在当前视口中。 | ||
|
|
||
| You can pass `ratio` argument as option, which means the minimal ratio of the element should be in viewport. `ratio` should be in 0~1. | ||
| 你可以通过参数 `ratio`,将视口中元素的最小比例设置为 `ratio`。`ratio` 的取值范围为 0~1。 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 连续的符号,无需使用空行隔离开 |
||
|
|
||
| 该方法通过 IntersectionObserver API检测元素是否位于当前视口内。 | ||
| 可通过 ratio参数指定元素在视口中的最小可见比例(取值范围为 0~1): | ||
| 该方法通过 IntersectionObserver API 检测元素是否位于当前视口内。 | ||
| 可通过 ratio 参数指定元素在视口中的最小可见比例(取值范围为 0~1): | ||
| ```ts | ||
| // 检测指定元素是否在视口中 | ||
| await expect.element(page.getByText('Welcome')).toBeInViewport() | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一段文字后面的标点符号不要丢掉。它将示意当前句子结束。