summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-07-16 13:19:26 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-07-16 00:19:26 -0400
commit9c454998646ef49f652bc919f53503ed07a1c55c (patch)
treea6275bdefa3da50cae08c6c0f753d816215d9602 /tests
parentbd6ebb32df11641e148fd0adca41e7188f16afce (diff)
Support window.onload (#2643)
Diffstat (limited to 'tests')
-rw-r--r--tests/034_onload.out7
-rw-r--r--tests/034_onload.test2
-rw-r--r--tests/034_onload/imported.ts8
-rw-r--r--tests/034_onload/main.ts14
-rw-r--r--tests/034_onload/nest_imported.ts7
-rw-r--r--tests/034_onload_imported.ts1
6 files changed, 39 insertions, 0 deletions
diff --git a/tests/034_onload.out b/tests/034_onload.out
new file mode 100644
index 000000000..0939be8cd
--- /dev/null
+++ b/tests/034_onload.out
@@ -0,0 +1,7 @@
+log from nest_imported script
+log from imported script
+log from main
+got load event in onload function
+got load event in event handler (nest_imported)
+got load event in event handler (imported)
+got load event in event handler (main)
diff --git a/tests/034_onload.test b/tests/034_onload.test
new file mode 100644
index 000000000..d3105656f
--- /dev/null
+++ b/tests/034_onload.test
@@ -0,0 +1,2 @@
+args: run --reload tests/034_onload/main.ts
+output: tests/034_onload.out
diff --git a/tests/034_onload/imported.ts b/tests/034_onload/imported.ts
new file mode 100644
index 000000000..5cf2d7b4c
--- /dev/null
+++ b/tests/034_onload/imported.ts
@@ -0,0 +1,8 @@
+import "./nest_imported.ts";
+window.addEventListener(
+ "load",
+ (e: Event): void => {
+ console.log(`got ${e.type} event in event handler (imported)`);
+ }
+);
+console.log("log from imported script");
diff --git a/tests/034_onload/main.ts b/tests/034_onload/main.ts
new file mode 100644
index 000000000..68851950a
--- /dev/null
+++ b/tests/034_onload/main.ts
@@ -0,0 +1,14 @@
+import "./imported.ts";
+
+window.addEventListener(
+ "load",
+ (e: Event): void => {
+ console.log(`got ${e.type} event in event handler (main)`);
+ }
+);
+
+window.onload = (e: Event): void => {
+ console.log(`got ${e.type} event in onload function`);
+};
+
+console.log("log from main");
diff --git a/tests/034_onload/nest_imported.ts b/tests/034_onload/nest_imported.ts
new file mode 100644
index 000000000..2e2bee1d5
--- /dev/null
+++ b/tests/034_onload/nest_imported.ts
@@ -0,0 +1,7 @@
+window.addEventListener(
+ "load",
+ (e: Event): void => {
+ console.log(`got ${e.type} event in event handler (nest_imported)`);
+ }
+);
+console.log("log from nest_imported script");
diff --git a/tests/034_onload_imported.ts b/tests/034_onload_imported.ts
new file mode 100644
index 000000000..d97aabeca
--- /dev/null
+++ b/tests/034_onload_imported.ts
@@ -0,0 +1 @@
+console.log("from imported script");