mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
add a test for script load order
This commit is contained in:
@@ -1350,6 +1350,7 @@ test "Browser: HTML.HtmlScriptElement" {
|
|||||||
try testing.htmlRunner("html/script/import.html");
|
try testing.htmlRunner("html/script/import.html");
|
||||||
try testing.htmlRunner("html/script/dynamic_import.html");
|
try testing.htmlRunner("html/script/dynamic_import.html");
|
||||||
try testing.htmlRunner("html/script/importmap.html");
|
try testing.htmlRunner("html/script/importmap.html");
|
||||||
|
try testing.htmlRunner("html/script/order.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
test "Browser: HTML.HtmlSlotElement" {
|
test "Browser: HTML.HtmlSlotElement" {
|
||||||
|
|||||||
35
src/tests/html/script/order.html
Normal file
35
src/tests/html/script/order.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../../testing.js"></script>
|
||||||
|
|
||||||
|
<script defer id="remote_defer" src="order_defer.js"></script>
|
||||||
|
<script defer id="remote_async" src="order_async.js"></script>
|
||||||
|
|
||||||
|
<script type=module id="inline_module">
|
||||||
|
// inline module is always deferred.
|
||||||
|
list += 'g';
|
||||||
|
testing.expectEqual('abcdefg', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var list = '';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="remote" src="order.js"></script>
|
||||||
|
|
||||||
|
<script async id="inline_async">
|
||||||
|
// inline script ignore async
|
||||||
|
list += 'b';
|
||||||
|
testing.expectEqual('ab', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script defer id="inline_defer">
|
||||||
|
// inline script ignore defer
|
||||||
|
list += 'c';
|
||||||
|
testing.expectEqual('abc', list);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="default">
|
||||||
|
// simple inline script
|
||||||
|
list += 'd';
|
||||||
|
testing.expectEqual('abcd', list);
|
||||||
|
</script>
|
||||||
2
src/tests/html/script/order.js
Normal file
2
src/tests/html/script/order.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
list += 'a';
|
||||||
|
testing.expectEqual('a', list);
|
||||||
3
src/tests/html/script/order_async.js
Normal file
3
src/tests/html/script/order_async.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
list += 'f';
|
||||||
|
testing.expectEqual('abcdef', list);
|
||||||
|
|
||||||
2
src/tests/html/script/order_defer.js
Normal file
2
src/tests/html/script/order_defer.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
list += 'e';
|
||||||
|
testing.expectEqual('abcde', list);
|
||||||
Reference in New Issue
Block a user