From 9de6bed1cd4f24f591c4aa2a3012501bd792c157 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 14 Oct 2015 19:26:10 +0100 Subject: Don't escape double quotes outside of attributes --- tests/html/write.tests.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/html') 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() { "<>&"); }); + 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": "<"})), '

'); }); + test("double quotes inside attributes are escaped", function() { + assert.equal( + generateString(html.freshElement("p", {"x": '"'})), + '

'); + }); + test("element children are written", function() { assert.equal( generateString(html.freshElement("p", {}, [html.text("Hello")])), -- cgit v1.2.3