Skip to content

Commit 11e6c7d

Browse files
committed
Fix test output for html/f004 for default extractAllScripts to false.
Add html/f005 with extractAllScripts set to true. For #603.
1 parent b8ac517 commit 11e6c7d

6 files changed

+87
-5
lines changed

tests/html-manifest.html

+37-1
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ <h2>
982982
</dl>
983983
</dd>
984984
<dt id='tf004'>
985-
Test tf004 Flattens all script elements by default
985+
Test tf004 Flattens first script element by default
986986
</dt>
987987
<dd>
988988
<dl class='entry'>
@@ -1015,6 +1015,42 @@ <h2>
10151015
</dd>
10161016
</dl>
10171017
</dd>
1018+
<dt id='tf005'>
1019+
Test tf005 Flattens all script elements if extractAllScripts set to true
1020+
</dt>
1021+
<dd>
1022+
<dl class='entry'>
1023+
<dt>id</dt>
1024+
<dd>#tf005</dd>
1025+
<dt>Type</dt>
1026+
<dd>jld:PositiveEvaluationTest, jld:FlattenTest, jld:HtmlTest</dd>
1027+
<dt>Purpose</dt>
1028+
<dd>Tests embedded JSON-LD in HTML multiple script elements</dd>
1029+
<dt>input</dt>
1030+
<dd>
1031+
<a href='html/f005-in.html'>html/f005-in.html</a>
1032+
</dd>
1033+
<dt>context</dt>
1034+
<dd>
1035+
<a href='html/f005-context.jsonld'>html/f005-context.jsonld</a>
1036+
</dd>
1037+
<dt>expect</dt>
1038+
<dd>
1039+
<a href='html/f005-out.jsonld'>html/f005-out.jsonld</a>
1040+
</dd>
1041+
<dt>Options</dt>
1042+
<dd>
1043+
<dl class='options'>
1044+
<dt>specVersion</dt>
1045+
<dd>json-ld-1.1</dd>
1046+
<dt>processorFeature</dt>
1047+
<dd>HTML Script Extraction</dd>
1048+
<dt>extractAllScripts</dt>
1049+
<dd>true</dd>
1050+
</dl>
1051+
</dd>
1052+
</dl>
1053+
</dd>
10181054
<dt id='tr001'>
10191055
Test tr001 Transforms embedded JSON-LD script element
10201056
</dt>

tests/html-manifest.jsonld

+14-1
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,25 @@
275275
}, {
276276
"@id": "#tf004",
277277
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest", "jld:HtmlTest"],
278-
"name": "Flattens all script elements by default",
278+
"name": "Flattens first script element by default",
279279
"purpose": "Tests embedded JSON-LD in HTML multiple script elements",
280280
"input": "html/f004-in.html",
281281
"context": "html/f004-context.jsonld",
282282
"expect": "html/f004-out.jsonld",
283283
"option": {"specVersion": "json-ld-1.1", "processorFeature": "HTML Script Extraction"}
284+
}, {
285+
"@id": "#tf005",
286+
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest", "jld:HtmlTest"],
287+
"name": "Flattens all script elements if extractAllScripts set to true",
288+
"purpose": "Tests embedded JSON-LD in HTML multiple script elements",
289+
"input": "html/f005-in.html",
290+
"context": "html/f005-context.jsonld",
291+
"expect": "html/f005-out.jsonld",
292+
"option": {
293+
"specVersion": "json-ld-1.1",
294+
"processorFeature": "HTML Script Extraction",
295+
"extractAllScripts": true
296+
}
284297
}, {
285298
"@id": "#tr001",
286299
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest", "jld:HtmlTest"],

tests/html/f004-out.jsonld

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
55
},
66
"@graph": [
7-
{"@id": "_:b0", "foo": ["bar"]},
8-
{"@id": "_:b1", "ex:foo": "foo"},
9-
{"@id": "_:b2", "ex:bar": "bar"}
7+
{"@id": "_:b0", "foo": ["bar"]}
108
]
119
}

tests/html/f005-context.jsonld

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"ex": "http://example.com/",
4+
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
5+
}
6+
}

tests/html/f005-in.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<html>
2+
<head>
3+
<script type="application/ld+json">
4+
{
5+
"@context": {
6+
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
7+
},
8+
"foo": [{"@value": "bar"}]
9+
}
10+
</script>
11+
<script type="application/ld+json">
12+
[
13+
{"http://example.com/foo": {"@value": "foo"}},
14+
{"http://example.com/bar": {"@value": "bar"}}
15+
]
16+
</script>
17+
</head>
18+
</html>

tests/html/f005-out.jsonld

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"@context": {
3+
"ex": "http://example.com/",
4+
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
5+
},
6+
"@graph": [
7+
{"@id": "_:b0", "foo": ["bar"]},
8+
{"@id": "_:b1", "ex:foo": "foo"},
9+
{"@id": "_:b2", "ex:bar": "bar"}
10+
]
11+
}

0 commit comments

Comments
 (0)