capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.14k stars 189 forks source link

document.fonts.ready is undefined #1478

Open ImLunaHey opened 3 weeks ago

ImLunaHey commented 3 weeks ago

Describe the bug document.fonts.ready is undefined.

To Reproduce

import { describe, it } from 'vitest';

async function isReady() {
  let ready = await document.fonts.ready;
  console.log(ready);
}

describe('aaaaa', () => {
  it('should work', async () => {
    await isReady();
  });
});
 FAIL  lib/dash/components/aaaaa.test.tsx > aaaaa > should work
TypeError: Cannot read properties of undefined (reading 'ready')
 ❯ isReady lib/dash/components/aaaaa.test.tsx:4:36
      2| 
      3| async function isReady() {
      4|   let ready = await document.fonts.ready;
       |                                    ^
      5|   console.log(ready);
      6| }
 ❯ lib/dash/components/aaaaa.test.tsx:10:11

Additional context https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/ready