test-web: Match WPT runner reftest-wait behavior

When a test has a `reftest-wait` class, we now wait for fonts to load
and then for 2 `requestAnimationFrame` callbacks. This matches the
behavior of the WPT runner and allows more imported WPT tests to work
correctly.
This commit is contained in:
Tim Ledbetter 2025-07-02 16:41:33 +01:00 committed by Jelle Raaijmakers
parent 504be366a2
commit a959d4dca2

View File

@ -314,7 +314,13 @@ function hasReftestWaitClass() {
}
if (!hasReftestWaitClass()) {
internals.signalTestIsDone("PASS");
document.fonts.ready.then(() => {
requestAnimationFrame(function() {
requestAnimationFrame(function() {
internals.signalTestIsDone("PASS");
});
});
});
} else {
const observer = new MutationObserver(() => {
if (!hasReftestWaitClass()) {