aboutsummaryrefslogtreecommitdiff
path: root/tests/html/write.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-14 19:26:10 +0100
committerMichael Williamson <mike@zwobble.org>2015-10-14 19:26:10 +0100
commit9de6bed1cd4f24f591c4aa2a3012501bd792c157 (patch)
treefbbab3fd96a8c48c124aef2e4ec34317c7a40440 /tests/html/write.tests.js
parente55b8f2614fccb2ac54b3ddebe1ed3eeb12e32c9 (diff)
Don't escape double quotes outside of attributes
Diffstat (limited to 'tests/html/write.tests.js')
-rw-r--r--tests/html/write.tests.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/html/write.tests.js b/tests/html/write.tests.js
index 34eaf15..e4a5813 100644
--- a/tests/html/write.tests.js
+++ b/tests/html/write.tests.js
@@ -12,12 +12,24 @@ describe("HTML write", function() {
"&lt;&gt;&amp;");
});
+ test("double quotes outside of attributes are not escaped", function() {
+ assert.equal(
+ generateString(html.text('"')),
+ '"');
+ });
+
test("element attributes are HTML escaped", function() {
assert.equal(
generateString(html.freshElement("p", {"x": "<"})),
'<p x="&lt;"></p>');
});
+ test("double quotes inside attributes are escaped", function() {
+ assert.equal(
+ generateString(html.freshElement("p", {"x": '"'})),
+ '<p x="&quot;"></p>');
+ });
+
test("element children are written", function() {
assert.equal(
generateString(html.freshElement("p", {}, [html.text("Hello")])),