diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html')
-rw-r--r-- | dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html new file mode 100644 index 0000000000..3139a60d37 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_load_importMap_with_base.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<head> + <meta charset=utf-8> + <title>Test a simple import map with a base element</title> +</head> +<body onload='testLoaded()'> + +<!-- This will change the baseURL of the document.--> +<base href="chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/scope1/"> + +<!-- +With the <base> element, the correct "module_simpleExport.js" should be mapped +to "scope1/module_simpleExport.js", instead of "./module_simpleExport.js". +--> + +<script type="importmap"> +{ + "imports": { + "simple": "./module_simpleExport.js" + } +} +</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.js"></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> |