[gjs/esm/dynamic-imports] And a test for imported scripts too!
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/esm/dynamic-imports] And a test for imported scripts too!
- Date: Tue, 9 Feb 2021 03:17:31 +0000 (UTC)
commit 2b74ef68a050c822b88f04d354293ce744eacd58
Author: Evan Welsh <contact evanwelsh com>
Date: Mon Feb 8 19:17:26 2021 -0800
And a test for imported scripts too!
installed-tests/js/jsunit.gresources.xml | 1 +
installed-tests/js/modules/dynamic.js | 8 ++++++++
installed-tests/js/testImporter.js | 6 ++++++
3 files changed, 15 insertions(+)
---
diff --git a/installed-tests/js/jsunit.gresources.xml b/installed-tests/js/jsunit.gresources.xml
index 624ac738..b635c50c 100644
--- a/installed-tests/js/jsunit.gresources.xml
+++ b/installed-tests/js/jsunit.gresources.xml
@@ -13,6 +13,7 @@
<file>modules/badOverrides/Regress.js</file>
<file>modules/badOverrides/WarnLib.js</file>
<file>modules/data.txt</file>
+ <file>modules/dynamic.js</file>
<file>modules/importmeta.js</file>
<file>modules/exports.js</file>
<file>modules/foobar.js</file>
diff --git a/installed-tests/js/modules/dynamic.js b/installed-tests/js/modules/dynamic.js
new file mode 100644
index 00000000..5fe44a73
--- /dev/null
+++ b/installed-tests/js/modules/dynamic.js
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
+// SPDX-FileCopyrightText: 2021 Evan Welsh
+
+async function test() {
+ const { say } = await import('./say.js');
+
+ return say('I did it!');
+}
diff --git a/installed-tests/js/testImporter.js b/installed-tests/js/testImporter.js
index 95fa50d1..9d4b0d8b 100644
--- a/installed-tests/js/testImporter.js
+++ b/installed-tests/js/testImporter.js
@@ -244,4 +244,10 @@ describe('Importer', function () {
expect(typeof say).toBe('function');
expect(say('hello')).toBe('<( hello )');
});
+
+ it("imported scripts support relative dynamic imports", async function() {
+ const response = await imports.dynamic.test();
+
+ expect(response).toBe('<( I did it! )');
+ });
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]