Skip to content

Commit

Permalink
docs(api.md): emulateMedia syntax fixes (#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik authored May 5, 2020
1 parent f6210ae commit 52aa929
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1082,31 +1082,31 @@ await page.dispatchEvent('#source', 'dragstart', { dataTransfer });
- returns: <[Promise]>

```js
await page.evaluate(() => matchMedia('screen').matches));
await page.evaluate(() => matchMedia('screen').matches);
// → true
await page.evaluate(() => matchMedia('print').matches));
await page.evaluate(() => matchMedia('print').matches);
// → false

await page.emulateMedia({ media: 'print' });
await page.evaluate(() => matchMedia('screen').matches));
await page.evaluate(() => matchMedia('screen').matches);
// → false
await page.evaluate(() => matchMedia('print').matches));
await page.evaluate(() => matchMedia('print').matches);
// → true

await page.emulateMedia({});
await page.evaluate(() => matchMedia('screen').matches));
await page.evaluate(() => matchMedia('screen').matches);
// → true
await page.evaluate(() => matchMedia('print').matches));
await page.evaluate(() => matchMedia('print').matches);
// → false
```

```js
await page.emulateMedia({ colorScheme: 'dark' }] });
await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches));
await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches);
// → true
await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches));
await page.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches);
// → false
await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches));
await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').matches);
// → false
```

Expand Down

0 comments on commit 52aa929

Please sign in to comment.