Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions guide/browser/assertion-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一段文字后面的标点符号不要丢掉。它将示意当前句子结束。

允许你通过 [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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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()
Expand Down