mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
add script loading test
This commit is contained in:
2
src/browser/tests/element/html/script/load-me.js
Normal file
2
src/browser/tests/element/html/script/load-me.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
let a = 0;
|
||||||
|
a++;
|
||||||
@@ -10,3 +10,26 @@
|
|||||||
testing.expectEqual('http://127.0.0.1:9582/over.9000.js', s.src);
|
testing.expectEqual('http://127.0.0.1:9582/over.9000.js', s.src);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id="load-trigger-event">
|
||||||
|
{
|
||||||
|
const script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.src="./load-me.js";
|
||||||
|
|
||||||
|
script.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(script, target);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.head.appendChild(script);
|
||||||
|
|
||||||
|
testing.expectEqual("text/javascript", script.type);
|
||||||
|
testing.expectEqual("http://127.0.0.1:9582/src/browser/tests/element/html/script/load-me.js", script.src);
|
||||||
|
testing.expectEqual(true, true);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user