update-on-style-change.html (1213B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>LargestContentfulPaint entries should NOT be emitted for updates to previous LargestContentfulPaint elements.</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <body> 8 <script> 9 promise_test(async (t) => { 10 assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented"); 11 let lcpEntries = []; 12 await new Promise(resolve => t.step_timeout(() => { 13 new PerformanceObserver(list => { 14 lcpEntries = lcpEntries.concat(list.getEntries()) 15 if (lcpEntries.length > 1) { 16 assert_unreached("There shouldn't be more than 1 LCP entry for an element."); 17 } 18 if (lcpEntries) { 19 assert_equals(lcpEntries.length, 1, "There should be only 1 LCP entry for one element. "); 20 assert_equals(lcpEntries[0].id, "text", "The LCP should have id 'text'"); 21 resolve(); 22 } 23 }).observe({ type: 'largest-contentful-paint', buffered: true }); 24 }, 200)); 25 }) 26 </script> 27 <div id="text">text</div> 28 <link rel="stylesheet" href="resources/slow-style-change.py"> 29 </body>