40 lines
1.1 KiB
HTML
40 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
const log = [];
|
|
|
|
// First, use a module specifier
|
|
promise_test(() => {
|
|
return import("../resources/log.js?pipe=sub&name=A")
|
|
.then(() => {
|
|
assert_array_equals(log, ["log:A"], "First import should use original module");
|
|
});
|
|
}, "Initial import before import map");
|
|
|
|
// Now try to redefine it with multiple import map rules
|
|
</script>
|
|
<script type="importmap">
|
|
{
|
|
"imports": {
|
|
"../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=B",
|
|
"http:/": "../resources/log.js?pipe=sub&name=scheme",
|
|
"https:/": "../resources/log.js?pipe=sub&name=scheme"
|
|
}
|
|
}
|
|
</script>
|
|
<script type="module">
|
|
// Testing that the resolution is correct using `resolve`, as you can't import
|
|
// the same module twice.
|
|
test(() => {
|
|
assert_true(import.meta.resolve("../resources/log.js?pipe=sub&name=A")
|
|
.endsWith("/resources/log.js?pipe=sub&name=A"));
|
|
}, "Resolution after import map should not be redefined");
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|