-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1557436 [wpt PR 16734] - Add some initial tests for JSON modules.…
…, a=testonly Automatic update from web-platform-tests Add some initial tests for JSON modules. See <whatwg/html#4407>. -- wp5At-commits: f510720b12c7d0dd3e0639bac35aceb237c2221c wpt-pr: 16734 UltraBlame original commit: d18767ce41b850b8929ad67e8367a5fb80eda67d
- Loading branch information
Showing
14 changed files
with
1,649 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...g/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/array.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
" | ||
en | ||
" | ||
" | ||
try | ||
" | ||
] |
1 change: 1 addition & 0 deletions
1
...g/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/false.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
false |
215 changes: 215 additions & 0 deletions
215
...tests/html/semantics/scripting-1/the-script-element/json-module/invalid-content-type.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
utf | ||
- | ||
8 | ||
> | ||
< | ||
title | ||
> | ||
JSON | ||
modules | ||
: | ||
invalid | ||
Content | ||
- | ||
Type | ||
< | ||
/ | ||
title | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
div | ||
id | ||
= | ||
log | ||
> | ||
< | ||
/ | ||
div | ||
> | ||
< | ||
script | ||
> | ||
const | ||
content_types | ||
= | ||
[ | ||
" | ||
application | ||
/ | ||
json | ||
+ | ||
protobuf | ||
" | ||
" | ||
application | ||
/ | ||
json | ||
+ | ||
blah | ||
" | ||
" | ||
text | ||
/ | ||
x | ||
- | ||
json | ||
" | ||
" | ||
text | ||
/ | ||
json | ||
+ | ||
blah | ||
" | ||
" | ||
application | ||
/ | ||
blahjson | ||
" | ||
" | ||
image | ||
/ | ||
json | ||
" | ||
] | ||
; | ||
for | ||
( | ||
const | ||
content_type | ||
of | ||
content_types | ||
) | ||
{ | ||
async_test | ||
( | ||
t | ||
= | ||
> | ||
{ | ||
const | ||
script | ||
= | ||
document | ||
. | ||
createElement | ||
( | ||
" | ||
script | ||
" | ||
) | ||
; | ||
script | ||
. | ||
onerror | ||
= | ||
t | ||
. | ||
step_func_done | ||
( | ||
) | ||
; | ||
script | ||
. | ||
onload | ||
= | ||
t | ||
. | ||
unreached_func | ||
( | ||
" | ||
Should | ||
not | ||
load | ||
" | ||
) | ||
; | ||
script | ||
. | ||
type | ||
= | ||
" | ||
module | ||
" | ||
; | ||
script | ||
. | ||
src | ||
= | ||
module | ||
. | ||
json | ||
? | ||
pipe | ||
= | ||
header | ||
( | ||
Content | ||
- | ||
Type | ||
{ | ||
content_type | ||
} | ||
) | ||
; | ||
document | ||
. | ||
body | ||
. | ||
appendChild | ||
( | ||
script | ||
) | ||
; | ||
} | ||
content_type | ||
) | ||
; | ||
} | ||
< | ||
/ | ||
script | ||
> |
170 changes: 170 additions & 0 deletions
170
.../web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/module.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
< | ||
! | ||
DOCTYPE | ||
html | ||
> | ||
< | ||
meta | ||
charset | ||
= | ||
utf | ||
- | ||
8 | ||
> | ||
< | ||
title | ||
> | ||
JSON | ||
modules | ||
< | ||
/ | ||
title | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharness | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
src | ||
= | ||
" | ||
/ | ||
resources | ||
/ | ||
testharnessreport | ||
. | ||
js | ||
" | ||
> | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
div | ||
id | ||
= | ||
log | ||
> | ||
< | ||
/ | ||
div | ||
> | ||
< | ||
script | ||
> | ||
const | ||
t | ||
= | ||
async_test | ||
( | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> | ||
< | ||
script | ||
type | ||
= | ||
" | ||
module | ||
" | ||
onerror | ||
= | ||
" | ||
t | ||
. | ||
step | ||
( | ||
( | ||
) | ||
= | ||
> | ||
assert_unreached | ||
( | ||
event | ||
) | ||
) | ||
" | ||
> | ||
import | ||
v | ||
from | ||
" | ||
. | ||
/ | ||
module | ||
. | ||
json | ||
" | ||
; | ||
t | ||
. | ||
step | ||
( | ||
( | ||
) | ||
= | ||
> | ||
{ | ||
assert_equals | ||
( | ||
typeof | ||
v | ||
" | ||
object | ||
" | ||
) | ||
; | ||
assert_array_equals | ||
( | ||
Object | ||
. | ||
keys | ||
( | ||
v | ||
) | ||
[ | ||
" | ||
test | ||
" | ||
] | ||
) | ||
; | ||
assert_equals | ||
( | ||
v | ||
. | ||
test | ||
true | ||
) | ||
; | ||
t | ||
. | ||
done | ||
( | ||
) | ||
; | ||
} | ||
) | ||
; | ||
< | ||
/ | ||
script | ||
> |
Oops, something went wrong.