Skip to content

Commit 1288d8e

Browse files
committed
HTML tests for expand, compact, flatten and toRdf.
1 parent 9c8088b commit 1288d8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+808
-0
lines changed

tests/compact-manifest.jsonld

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,42 @@
11301130
"input": "compact/ep15-in.jsonld",
11311131
"context": "compact/ep15-context.jsonld",
11321132
"expect": "invalid container mapping"
1133+
}, {
1134+
"@id": "#th001",
1135+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1136+
"name": "Compacts embedded JSON-LD script element",
1137+
"purpose": "Tests embedded JSON-LD in HTML",
1138+
"input": "compact/h001-in.html",
1139+
"context": "compact/h001-context.jsonld",
1140+
"expect": "compact/h001-out.jsonld",
1141+
"option": {"specVersion": "json-ld-1.1"}
1142+
}, {
1143+
"@id": "#th002",
1144+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1145+
"name": "Compacts first embedded JSON-LD script element",
1146+
"purpose": "Tests embedded JSON-LD in HTML",
1147+
"input": "compact/h002-in.html",
1148+
"context": "compact/h002-context.jsonld",
1149+
"expect": "compact/h002-out.jsonld",
1150+
"option": {"specVersion": "json-ld-1.1"}
1151+
}, {
1152+
"@id": "#th003",
1153+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1154+
"name": "Compacts targeted JSON-LD script element",
1155+
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
1156+
"input": "compact/h003-in.html#second",
1157+
"context": "compact/h003-context.jsonld",
1158+
"expect": "compact/h003-out.jsonld",
1159+
"option": {"specVersion": "json-ld-1.1"}
1160+
}, {
1161+
"@id": "#th004",
1162+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1163+
"name": "Compacts all embedded JSON-LD script elements with extractAllScripts option",
1164+
"purpose": "Tests embedded JSON-LD in HTML extracting all elements",
1165+
"input": "compact/h004-in.html",
1166+
"context": "compact/h004-context.jsonld",
1167+
"expect": "compact/h004-out.jsonld",
1168+
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
11331169
}, {
11341170
"@id": "#tm001",
11351171
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],

tests/compact/h001-context.jsonld

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

tests/compact/h001-in.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
</head>
12+
</html>

tests/compact/h001-out.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
4+
},
5+
"foo": ["bar"]
6+
}

tests/compact/h002-context.jsonld

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

tests/compact/h002-in.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
"@context": {"ex": "http://example.com/"},
14+
"@graph": [
15+
{"ex:foo": {"@value": "foo"}},
16+
{"ex:bar": {"@value": "bar"}}
17+
]
18+
}
19+
</script>
20+
</head>
21+
</html>

tests/compact/h002-out.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"foo": {"@id": "http://example.com/foo", "@container": "@list"}
4+
},
5+
"foo": ["bar"]
6+
}

tests/compact/h003-context.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": {"ex": "http://example.com/"}
3+
}

tests/compact/h003-in.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<html>
2+
<head>
3+
<script id="first" 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 id="second" type="application/ld+json">
12+
{
13+
"@context": {"ex": "http://example.com/"},
14+
"@graph": [
15+
{"ex:foo": {"@value": "foo"}},
16+
{"ex:bar": {"@value": "bar"}}
17+
]
18+
}
19+
</script>
20+
</head>
21+
</html>

tests/compact/h003-out.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": {"ex": "http://example.com/"},
3+
"@graph": [
4+
{"ex:foo": "foo"},
5+
{"ex:bar": "bar"}
6+
]
7+
}

0 commit comments

Comments
 (0)