diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/array.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/array.json new file mode 100644 index 000000000000..e77e32d3382e --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/array.json @@ -0,0 +1 @@ +["en", "try"] diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/false.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/false.json new file mode 100644 index 000000000000..c508d5366f70 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/false.json @@ -0,0 +1 @@ +false diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type.html new file mode 100644 index 000000000000..e6da2db7ebc0 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type.html @@ -0,0 +1,26 @@ + + +JSON modules: invalid Content-Type + + +
+ diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.html new file mode 100644 index 000000000000..932438532268 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.html @@ -0,0 +1,18 @@ + + +JSON modules + + +
+ + diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.json new file mode 100644 index 000000000000..f834b2a4e8fa --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.json @@ -0,0 +1,3 @@ +{ + "test": true +} diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/non-object.any.js b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/non-object.any.js new file mode 100644 index 000000000000..2c7d8a7683c5 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/non-object.any.js @@ -0,0 +1,14 @@ + + +for (const value of [null, true, false, "string"]) { + promise_test(async t => { + const result = await import(`./${value}.json`); + assert_equals(result, value); + }, `Non-object: ${value}`); +} + +promise_test(async t => { + const result = await import("./array.json"); + assert_array_equals(result, ["en", "try"]); +}, "Non-object: array"); + diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/null.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/null.json new file mode 100644 index 000000000000..19765bd501b6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/null.json @@ -0,0 +1 @@ +null diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.html new file mode 100644 index 000000000000..68d3ef0a9ad3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.html @@ -0,0 +1,21 @@ + + +JSON modules: parse error + + +
+ + diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.json new file mode 100644 index 000000000000..98232c64fce9 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/parse-error.json @@ -0,0 +1 @@ +{ diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/string.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/string.json new file mode 100644 index 000000000000..ace2d72d9d3d --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/string.json @@ -0,0 +1 @@ +"string" diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/true.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/true.json new file mode 100644 index 000000000000..27ba77ddaf61 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/true.json @@ -0,0 +1 @@ +true diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.html new file mode 100644 index 000000000000..1c0360b17e3f --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.html @@ -0,0 +1,36 @@ + + +JSON modules: UTF-8 decoding + + +
+ + + + + diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.json b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.json new file mode 100644 index 000000000000..7bb9edd2f79e --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/utf8.json @@ -0,0 +1,3 @@ +{ + "test": "…" +} diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.html new file mode 100644 index 000000000000..78e8b1d23fed --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/valid-content-type.html @@ -0,0 +1,36 @@ + + +JSON modules: Content-Type + + +
+ + + + +