mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 14:33:47 +00:00
add inline <img src="..." /> test
This commit is contained in:
@@ -123,3 +123,36 @@
|
|||||||
testing.expectEqual(0, count);
|
testing.expectEqual(0, count);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<img
|
||||||
|
id="inline-img"
|
||||||
|
src="https://cdn.lightpanda.io/website/assets/images/docs/hn.png"
|
||||||
|
onload="(() => testing.expectEqual(true, true))()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<script id="inline-on-load">
|
||||||
|
{
|
||||||
|
const img = document.getElementById("inline-img");
|
||||||
|
testing.expectEqual(true, img.onload instanceof Function);
|
||||||
|
// Also call inline to double check.
|
||||||
|
img.onload();
|
||||||
|
|
||||||
|
// Make sure ones attached with `addEventListener` also executed.
|
||||||
|
testing.async(async () => {
|
||||||
|
const result = await new Promise(resolve => {
|
||||||
|
img.addEventListener("load", ({ bubbles, cancelBubble, cancelable, composed, isTrusted, target }) => {
|
||||||
|
testing.expectEqual(false, bubbles);
|
||||||
|
testing.expectEqual(false, cancelBubble);
|
||||||
|
testing.expectEqual(false, cancelable);
|
||||||
|
testing.expectEqual(false, composed);
|
||||||
|
testing.expectEqual(true, isTrusted);
|
||||||
|
testing.expectEqual(img, target);
|
||||||
|
|
||||||
|
return resolve(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
testing.expectEqual(true, result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user