mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(types): add types for page.$$eval (#6139)
* feat(types): add types for `page.$$eval` * Add new-docs for $$eval * fix example * linting
This commit is contained in:
@@ -218,7 +218,7 @@ describe('querySelector', function () {
|
||||
'<html><body><div class="tweet"><div class="like">100</div><div class="like">10</div></div></body></html>'
|
||||
);
|
||||
const tweet = await page.$('.tweet');
|
||||
const content = await tweet.$$eval('.like', (nodes) =>
|
||||
const content = await tweet.$$eval('.like', (nodes: HTMLElement[]) =>
|
||||
nodes.map((n) => n.innerText)
|
||||
);
|
||||
expect(content).toEqual(['100', '10']);
|
||||
@@ -231,7 +231,7 @@ describe('querySelector', function () {
|
||||
'<div class="a">not-a-child-div</div><div id="myId"><div class="a">a1-child-div</div><div class="a">a2-child-div</div></div>';
|
||||
await page.setContent(htmlContent);
|
||||
const elementHandle = await page.$('#myId');
|
||||
const content = await elementHandle.$$eval('.a', (nodes) =>
|
||||
const content = await elementHandle.$$eval('.a', (nodes: HTMLElement[]) =>
|
||||
nodes.map((n) => n.innerText)
|
||||
);
|
||||
expect(content).toEqual(['a1-child-div', 'a2-child-div']);
|
||||
|
||||
Reference in New Issue
Block a user