docs(api): fix coverage example and typo (#1854)

This commit is contained in:
Eric Bidelman 2018-01-18 21:19:13 -08:00 committed by Andrey Lushnikov
parent 49d3799e32
commit e031264231

View File

@ -612,8 +612,8 @@ Bare in mind that if `click()` triggers a navigation event and there's a separat
```javascript ```javascript
const [response] = await Promise.all([ const [response] = await Promise.all([
this.waitForNavigation(waitOptions), page.waitForNavigation(waitOptions),
this.click(selector, clickOptions), page.click(selector, clickOptions),
]); ]);
``` ```
@ -2250,19 +2250,19 @@ executed code:
```js ```js
// Enable both JavaScript and CSS coverage // Enable both JavaScript and CSS coverage
await Promise.all([ await Promise.all([
page.startJSCoverage(), page.coverage.startJSCoverage(),
page.startCSSCoverage() page.coverage.startCSSCoverage()
]); ]);
// Navigate to page // Navigate to page
await page.goto('https://example.com'); await page.goto('https://example.com');
// Disable both JavaScript and CSS coverage // Disable both JavaScript and CSS coverage
const [jsCoverage, cssCoverage] = await Promise.all([ const [jsCoverage, cssCoverage] = await Promise.all([
page.stopJSCoverage(), page.coverage.stopJSCoverage(),
page.stopCSSCoverage(), page.coverage.stopCSSCoverage(),
]); ]);
let totalBytes = 0; let totalBytes = 0;
let usedBytes = 0; let usedBytes = 0;
const coverage = [].concat(jsCoverage, cssCoverage); const coverage = [...jsCoverage, ...cssCoverage];
for (const entry of coverage) { for (const entry of coverage) {
totalBytes += entry.text.length; totalBytes += entry.text.length;
for (const range of entry.ranges) for (const range of entry.ranges)