blob: 7ab3fe96dac6d29172c01b8285b96cc3f44a695c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>Test a simple import map with a script creates a base element</title>
</head>
<body onload='testLoaded()'>
<!--This script will create a base element.-->
<script src="insert_a_base_element.js"></script>
<!--
With the <base> element, the correct "module_simpleExport.mjs" should be mapped
to "scope1/module_simpleExport.mjs", instead of "./module_simpleExport.mjs".
-->
<script type="importmap">
{
"imports": {
"simple": "./module_simpleExport.mjs"
}
}
</script>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="module">
import { x } from "simple";
result2 = x;
</script>
<script type="module" src="module_simpleImportMap.mjs"></script>
<script>
var result_scope1, result2;
SimpleTest.waitForExplicitFinish();
function testLoaded() {
ok(result_scope1 == 84, 'Check imported value result_scope1: ' + result_scope1);
ok(result2 == 84, 'Check imported value result2: ' + result2);
import("simple").then((ns) => {
ok(ns.x == 84, 'Check simple imported value result: ' + ns.x);
}).catch((e) => {
ok(false, "throws " + e);
}).then(() => {
SimpleTest.finish();
});
}
</script>
</body>
|