add load event test

This commit is contained in:
Halil Durak
2026-01-21 18:19:02 +03:00
parent 91e8f5e9ba
commit acd46feff6

View File

@@ -97,3 +97,28 @@
testing.expectEqual('lazy', img.getAttribute('loading')); testing.expectEqual('lazy', img.getAttribute('loading'));
} }
</script> </script>
<script id="load-trigger-event">
{
const img = document.createElement("img");
let count = 0;
img.addEventListener("load", ({ bubbles, cancelBubble, cancelable, composed, isTrusted, target }) => {
count++;
testing.expectEqual(false, bubbles);
testing.expectEqual(false, cancelBubble);
testing.expectEqual(false, cancelable);
testing.expectEqual(false, composed);
testing.expectEqual(true, isTrusted);
testing.expectEqual(img, target);
});
for (let i = 0; i < 3; i++) {
img.src = "https://cdn.lightpanda.io/website/assets/images/docs/hn.png";
testing.expectEqual("https://cdn.lightpanda.io/website/assets/images/docs/hn.png", img.src);
}
// Should work since we synchronously exeute the listener.
testing.expectEqual(3, count);
}
</script>