OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>html-script-module-imports</title> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <h1>html-script-module-imports</h1> |
| 10 |
| 11 <script type="module"> |
| 12 |
| 13 import { A } from "./imports-a.js"; |
| 14 |
| 15 test(function () { |
| 16 assert_equals(A.from, "imports-a.js", "Unexpected A"); |
| 17 }, "Import a simple module"); |
| 18 |
| 19 </script> |
| 20 <script type="module"> |
| 21 |
| 22 import { B as B_RENAMED } from "./imports-b.js"; |
| 23 |
| 24 test(function () { |
| 25 assert_equals(B_RENAMED.from, "imports-b.js", "Unexpected B_RENAMED"
); |
| 26 |
| 27 try |
| 28 { |
| 29 B; |
| 30 assert_unreached("Unexpectedly defined B"); |
| 31 } |
| 32 catch (ex) |
| 33 {} |
| 34 }, "Import a simple module, renamed"); |
| 35 |
| 36 </script> |
| 37 <script type="module"> |
| 38 |
| 39 import { INC_A } from "./imports-inc-a.js"; |
| 40 import { INC_B } from "./imports-inc-b.js"; |
| 41 import { INC_AB_A, INC_AB_B } from "./imports-inc-ab.js"; |
| 42 |
| 43 test(function () { |
| 44 assert_equals(INC_A.from, "imports-a.js", "Unexpected INC_A"); |
| 45 assert_equals(INC_B.from, "imports-b.js", "Unexpected INC_A"); |
| 46 assert_equals(INC_AB_A.from, "imports-a.js", "Unexpected INC_A"); |
| 47 assert_equals(INC_AB_B.from, "imports-b.js", "Unexpected INC_A"); |
| 48 assert_equals(INC_A, INC_AB_A, "INC_A and INC_AB_A should be the sam
e"); |
| 49 assert_equals(INC_B, INC_AB_B, "INC_B and INC_AB_B should be the sam
e"); |
| 50 }, "Import the same module multiple times"); |
| 51 |
| 52 </script> |
| 53 |
| 54 <script> |
| 55 var test_importSelf = async_test("Import a module that tries to import i
tself"); |
| 56 </script> |
| 57 <script type="module" src="imports-self.js" onerror="test_importSelf.done();
"></script> |
| 58 |
| 59 <script> |
| 60 var test_importCycle = async_test("Import a module with a cyclical modul
e dependency"); |
| 61 </script> |
| 62 <script type="module" src="imports-cycle.js" onerror="test_importCycle.done(
);"></script> |
| 63 </body> |
| 64 </html> |
OLD | NEW |