thenavisapp
Version:
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
149 lines (148 loc) • 7.83 kB
JSON
[
{
"name": "Template content",
"input": "<body><template>Some <div>content</div></template></body>",
"expected": "<html><head></head><body><template>Some <div>content</div></template></body></html>"
},
{
"name": "Attributes",
"input": "<head><meta http-equiv=\"refresh\" content=\"30\"></head><body><div style=\"background-color:red; padding: 0 25px 32px;\"></body>",
"expected": "<html><head><meta http-equiv=\"refresh\" content=\"30\"></head><body><div style=\"background-color:red; padding: 0 25px 32px;\"></div></body></html>"
},
{
"name": "Attribute serialized name - XML namespace",
"input": "<svg xml:base=\"http://example.org\"></svg>",
"expected": "<html><head></head><body><svg xml:base=\"http://example.org\"></svg></body></html>"
},
{
"name": "Attribute serialized name - XMLNS namespace",
"input": "<svg xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"></svg",
"expected": "<html><head></head><body><svg xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"></svg></body></html>"
},
{
"name": "Attribute serialized name - XLink namespace",
"input": "<svg xlink:title=\"Hey!\"></svg>",
"expected": "<html><head></head><body><svg xlink:title=\"Hey!\"></svg></body></html>"
},
{
"name": "Attribute value escaping - &",
"input": "<div data-foo=\"& 42 &\"></div>",
"expected": "<html><head></head><body><div data-foo=\"& 42 &\"></div></body></html>"
},
{
"name": "Attribute value escaping - ",
"input": "<div data-foo=\"\u00A0 bar\u00A0\"></div>",
"expected": "<html><head></head><body><div data-foo=\" bar \"></div></body></html>"
},
{
"name": "Attribute value escaping - quotes",
"input": "<div data-foo=\""\" id=test1\" class='test2\"'></div>",
"expected": "<html><head></head><body><div data-foo=\""\" id=\"test1"\" class=\"test2"\"></div></body></html>"
},
{
"name": "Attribute value escaping - < and >",
"input": "<div data-foo=\"<span>\"></div>",
"expected": "<html><head></head><body><div data-foo=\"<span>\"></div></body></html>"
},
{
"name": "Attributes value escaping - other entities",
"input": "<div data-foo='»☎'>",
"expected": "<html><head></head><body><div data-foo=\"»☎\"></div></body></html>"
},
{
"name": "Void elements",
"input": "<area><base><basefont><bgsound><br><embed><hr><img><input><keygen><link><meta><param><source><track><wbr>",
"expected": "<html><head></head><body><area><base><basefont><bgsound><br><embed><hr><img><input><keygen><link><meta><param><source><track><wbr></body></html>"
},
{
"name": "Void elements - <col>",
"input": "<table><col></table>",
"expected": "<html><head></head><body><table><colgroup><col></colgroup></table></body></html>"
},
{
"name": "Void elements - <frame>",
"input": "<frameset><frame></frameset>",
"expected": "<html><head></head><frameset><frame></frameset></html>"
},
{
"name": "Text nodes",
"input": "<title>foo</title><body>foo<div>bar</div>baz</body>",
"expected": "<html><head><title>foo</title></head><body>foo<div>bar</div>baz</body></html>"
},
{
"name": "Text nodes escaping - &",
"input": "<title>Mac&Cheese</title><div>&&&</div>",
"expected": "<html><head><title>Mac&Cheese</title></head><body><div>&&&</div></body></html>"
},
{
"name": "Text nodes escaping - ",
"input": "<title>\u00A0foo\u00A0bar\u00A0</title><div>\u00A0baz\u00A0</div>",
"expected": "<html><head><title> foo bar </title></head><body><div> baz </div></body></html>"
},
{
"name": "Text nodes escaping - < and >",
"input": "<title>< foo ></title><div>> bar <</div>",
"expected": "<html><head><title>< foo ></title></head><body><div>> bar <</div></body></html>"
},
{
"name": "Text nodes escaping - quotes",
"input": "<title>\"foo\"</title><div>\"bar\"</div>",
"expected": "<html><head><title>\"foo\"</title></head><body><div>\"bar\"</div></body></html>"
},
{
"name": "Text nodes escaping - non-escapable tags",
"input": "<body><style>&\u00A0><</style><script>&\u00A0><</script><xmp>&\u00A0><</xmp><iframe>&\u00A0><</iframe><noembed>&\u00A0><</noembed><noframes>&\u00A0><</noframes><plaintext>&\u00A0><",
"expected": "<html><head></head><body><style>&\u00A0><</style><script>&\u00A0><</script><xmp>&\u00A0><</xmp><iframe>&\u00A0><</iframe><noembed>&\u00A0><</noembed><noframes>&\u00A0><</noframes><plaintext>&\u00A0><</plaintext></body></html>"
},
{
"name": "Text nodes escaping - <noscript> with scripting enabled",
"input": "<body><noscript>& ><</noscript></body>",
"expected": "<html><head></head><body><noscript>& ><</noscript></body></html>"
},
{
"name": "Text nodes escaping - <noscript> with scripting disabled (GH-332)",
"options": { "scriptingEnabled": false },
"input": "<body><noscript>& ><</noscript></body>",
"expected": "<html><head></head><body><noscript>& ><</noscript></body></html>"
},
{
"name": "Comment nodes",
"input": "<!-- Hey --><html><head></head><!-- &\u00A0>< --><body><!-- 42 --></body></html>",
"expected": "<!-- Hey --><html><head></head><!-- &\u00A0>< --><body><!-- 42 --></body></html>"
},
{
"name": "Doctype without systemId and publicId",
"input": "",
"expected": "<html><head></head><body></body></html>"
},
{
"name": "Doctype with publicId",
"input": "