1
0
Fork 0
firefox/testing/web-platform/tests/largest-contentful-paint/background-image-set-image.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

41 lines
No EOL
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Background image-set images should be LCP candidates</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.background {
width: calc(100vw - 40px);
height: calc(100vw - 40px);
max-width: 100px;
max-height: 100px;
background: #eee image-set('/images/lcp-100x50.png' type('image/png')) center center no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div class="background"></div>
<p>fallback</p>
<script>
promise_test(async (t) => {
t.step_timeout(async () => {
let lcpEntryNames =
await new Promise(resolve => {
new PerformanceObserver((list) => {
resolve(list.getEntries().map(e => e.url));
}).observe({ type: "largest-contentful-paint", buffered: true });
});
assert_true(lcpEntryNames.find(e => e.includes('lcp-100x50')),
'Background image-set image should be an LCP candidate.');
}, 100);
}, "Background image-set images should be eligible for LCP candidates");
</script>
</body>
</html>