This commit is contained in:
Pavel Feldman 2022-09-27 09:29:34 -08:00 коммит произвёл GitHub
Родитель c25fb04030
Коммит bfd38bf7df
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 17 добавлений и 4 удалений

Просмотреть файл

@ -125,7 +125,7 @@ Returns locator to the last matching frame.
* since: v1.17
- returns: <[Locator]>
The method finds an element matching the specified selector in the FrameLocator's subtree.
%%-template-locator-locator-%%
### param: FrameLocator.locator.selector = %%-find-selector-%%
* since: v1.17

Просмотреть файл

@ -762,7 +762,7 @@ Returns locator to the last matching element.
* since: v1.14
- returns: <[Locator]>
The method finds an element matching the specified selector in the `Locator`'s subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.
%%-template-locator-locator-%%
### param: Locator.locator.selector = %%-find-selector-%%
* since: v1.14

Просмотреть файл

@ -1057,3 +1057,7 @@ When set to `"hide"`, screenshot will hide text caret. When set to `"initial"`,
- %%-screenshot-option-type-%%
- %%-screenshot-option-mask-%%
- %%-input-timeout-%%
## template-locator-locator
The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options, similar to [`method: Locator.filter`] method.

5
packages/playwright-core/types/types.d.ts поставляемый
Просмотреть файл

@ -9837,7 +9837,7 @@ export interface Locator {
last(): Locator;
/**
* The method finds an element matching the specified selector in the `Locator`'s subtree. It also accepts filter options,
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to [locator.filter([options])](https://playwright.dev/docs/api/class-locator#locator-filter) method.
* @param selector A selector to use when resolving DOM element. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
@ -14738,7 +14738,8 @@ export interface FrameLocator {
last(): FrameLocator;
/**
* The method finds an element matching the specified selector in the FrameLocator's subtree.
* The method finds an element matching the specified selector in the locator's subtree. It also accepts filter options,
* similar to [locator.filter([options])](https://playwright.dev/docs/api/class-locator#locator-filter) method.
* @param selector A selector to use when resolving DOM element. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/

Просмотреть файл

@ -294,6 +294,14 @@ function applyTemplates(body, params) {
if (!template)
throw new Error('Bad template: ' + key);
node.children.push(...template.children.map(c => md.clone(c)));
} else if (node.text && node.text.includes('%%-template-')) {
node.text.replace(/%%-template-[^%]+-%%/, templateName => {
const template = paramsMap.get(templateName);
if (!template)
throw new Error('Bad template: ' + templateName);
const nodeIndex = parent.children.indexOf(node);
parent.children = [...parent.children.slice(0, nodeIndex), ...template.children, ...parent.children.slice(nodeIndex + 1)];
});
}
for (const child of node.children || [])
visit(child, node);