Skip to content

Encapsulate HTML processing #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 100 additions & 139 deletions index.html

Large diffs are not rendered by default.

20 changes: 7 additions & 13 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ More information and an RDFS definition of the test vocabulary can be found at [

# Design

Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [compact](compact-manifest.jsonld), [expand](expand-manifest.jsonld), [flatten](flatten-manifest.jsonld), [remote-doc](remote-doc-manifest.jsonld), [fromRdf](fromRdf-manifest.jsonld), and [toRdf](toRdf-manifest.jsonld) sections:
Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [compact](compact-manifest.jsonld), [expand](expand-manifest.jsonld), [flatten](flatten-manifest.jsonld), [html](html-manifest.jsonld), [remote-doc](remote-doc-manifest.jsonld), [fromRdf](fromRdf-manifest.jsonld), and [toRdf](toRdf-manifest.jsonld) sections:

* [compact](compact-manifest.jsonld) tests have _input_, _expected_ and _context_ documents.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output. Additionally, if the `ordered` option is not set, result should be expanded and compared with the expanded _expected_ document also using [JSON-LD object comparison](#json-ld-object-comparison).
Expand All @@ -18,6 +18,12 @@ Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [
* [expand](expand-manifest.jsonld) tests have _input_ and _expected_ documents.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output.

For *NegativeEvaluationTests*, the result is a string associated with the expected error code.
* [html](html.jsonld) tests have _input_ and _expected_ documents and an optional _context_ document.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output
after potentially remapping blank node identifiers (see below).
Additionally, if the result is compacted and the `ordered` option is not set, result should be expanded and compared with the expanded _expected_ document also using [JSON-LD object comparison](#json-ld-object-comparison).

For *NegativeEvaluationTests*, the result is a string associated with the expected error code.
* [flatten](flatten-manifest.jsonld) tests have _input_ and _expected_ documents and an optional _context_ document.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output
Expand All @@ -37,18 +43,6 @@ Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output.
* [toRdf](toRdf-manifest.jsonld) tests have _input_ and _expected_ documents.
The _expected_ results can be compared using [RDF Dataset Isomorphism](https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism).
* _http_ tests have _input_ and _expected_ documents and an optional _context_ document.
These tests describe the behavior of an HTTP server performing content-negotiation using the ACCEPT header, specified using the _accept_ option to generate the _expected_ result document.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output
after potentially remapping blank node identifiers (see below).
Additionally, if the result is compacted and the `ordered` option is not set, result should be expanded and compared with the expanded _expected_ document also using [JSON-LD object comparison](#json-ld-object-comparison).

If the result is to be compacted, and no explicit context URL is provided, test subjects should use http/default-context.jsonld

If the profile parameter includes http://example.com/do-not-use, test subjects should reject the URL and not accept the media type. Otherwise, for any other URL, applications should apply the specified URL for the context or frame, as appropriate.

For *NegativeEvaluationTests*, the result is the expected HTTP status. Options may be present to describe the intended HTTP behavior:
* _accept_: The HTTP _Accept_ header value.

Unless `processingMode` is set explicitly in a test entry, `processingMode` is compatible with both `json-ld-1.0` and `json-ld-1.1`.

Expand Down
36 changes: 0 additions & 36 deletions tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1292,42 +1292,6 @@
"input": "compact/ep15-in.jsonld",
"context": "compact/ep15-context.jsonld",
"expect": "invalid container mapping"
}, {
"@id": "#th001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compacts embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "compact/h001-in.html",
"context": "compact/h001-context.jsonld",
"expect": "compact/h001-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th002",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compacts first embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "compact/h002-in.html",
"context": "compact/h002-context.jsonld",
"expect": "compact/h002-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th003",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compacts targeted JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
"input": "compact/h003-in.html#second",
"context": "compact/h003-context.jsonld",
"expect": "compact/h003-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th004",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compacts all embedded JSON-LD script elements with extractAllScripts option",
"purpose": "Tests embedded JSON-LD in HTML extracting all elements",
"input": "compact/h004-in.html",
"context": "compact/h004-context.jsonld",
"expect": "compact/h004-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
}, {
"@id": "#tin01",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand Down
160 changes: 0 additions & 160 deletions tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1524,166 +1524,6 @@
"input": "expand/es02-in.jsonld",
"expect": "invalid container mapping",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#th001",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h001-in.html",
"expect": "expand/h001-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th002",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands first embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h002-in.html",
"expect": "expand/h002-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th003",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands targeted JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
"input": "expand/h003-in.html#second",
"expect": "expand/h003-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th004",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands all embedded JSON-LD script elements with extractAllScripts option",
"purpose": "Tests embedded JSON-LD in HTML extracting all elements",
"input": "expand/h004-in.html",
"expect": "expand/h004-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
}, {
"@id": "#th005",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands multiple embedded JSON-LD script elements where one is an array",
"purpose": "Tests embedded JSON-LD in HTML extracting all elements with array",
"input": "expand/h005-in.html",
"expect": "expand/h005-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
}, {
"@id": "#th006",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands as empty with no embedded JSON-LD script elements",
"purpose": "Tests embedded JSON-LD in HTML when none exist",
"input": "expand/h006-in.html",
"expect": "expand/h006-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th007",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands as empty with no embedded JSON-LD script elements and extractAllScripts",
"purpose": "Tests embedded JSON-LD in HTML when none exist extracting all elements",
"input": "expand/h007-in.html",
"expect": "expand/h007-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
}, {
"@id": "#th010",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element with HTML character references",
"purpose": "Tests embedded JSON-LD in HTML with character references",
"input": "expand/h010-in.html",
"expect": "expand/h010-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th011",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if no element found at target",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier that doesn't exist",
"input": "expand/h011-in.html#third",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th012",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if targeted element is not a script element",
"purpose": "Tests embedded JSON-LD in HTML which isn't a script element",
"input": "expand/h012-in.html#first",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th013",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if targeted element does not have type application/ld+json",
"purpose": "Tests embedded JSON-LD in HTML with wrong type",
"input": "expand/h013-in.html#first",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th014",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if uncommented script text contains comment",
"purpose": "Tests embedded JSON-LD in HTML with comments leftover",
"input": "expand/h014-in.html",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th015",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if end comment missing",
"purpose": "Tests embedded JSON-LD in HTML with unballanced comments",
"input": "expand/h015-in.html",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th016",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if start comment missing",
"purpose": "Tests embedded JSON-LD in HTML with unballanced comments",
"input": "expand/h016-in.html",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th017",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Errors if uncommented script is not valid JSON",
"purpose": "Tests embedded JSON-LD in HTML which is invalid JSON",
"input": "expand/h017-in.html",
"expect": "invalid script element",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th018",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element relative to document base",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h018-in.html",
"expect": "expand/h018-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th019",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element relative to base option",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h019-in.html",
"expect": "expand/h019-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "base": "http://a.example.com/doc"}
}, {
"@id": "#th020",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element relative to HTML base",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h020-in.html",
"expect": "expand/h020-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "base": "http://a.example.com/doc"}
}, {
"@id": "#th021",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands embedded JSON-LD script element relative to relative HTML base",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "expand/h021-in.html",
"expect": "expand/h021-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "base": "http://a.example.com/doc"}
}, {
"@id": "#th022",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands targeted JSON-LD script element with fragment and HTML base",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
"input": "expand/h022-in.html#second",
"expect": "expand/h022-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tin01",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
Expand Down
4 changes: 0 additions & 4 deletions tests/expand/h018-out.jsonld

This file was deleted.

36 changes: 0 additions & 36 deletions tests/flatten-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -358,42 +358,6 @@
"option": {"specVersion": "json-ld-1.1"},
"input": "flatten/e001-in.jsonld",
"expect": "conflicting indexes"
}, {
"@id": "#th001",
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
"name": "Flattens embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "flatten/h001-in.html",
"context": "flatten/h001-context.jsonld",
"expect": "flatten/h001-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th002",
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
"name": "Flattens first embedded JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML",
"input": "flatten/h002-in.html",
"context": "flatten/h002-context.jsonld",
"expect": "flatten/h002-out.jsonld",
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": false}
}, {
"@id": "#th003",
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
"name": "Flattens targeted JSON-LD script element",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
"input": "flatten/h003-in.html#second",
"context": "flatten/h003-context.jsonld",
"expect": "flatten/h003-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#th004",
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
"name": "Flattens all script elements by default",
"purpose": "Tests embedded JSON-LD in HTML with fragment identifier",
"input": "flatten/h004-in.html",
"context": "flatten/h004-context.jsonld",
"expect": "flatten/h004-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tin01",
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
Expand Down
Loading