From fba50901e45483a339a16334b628271f770baddf Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 14 Nov 2016 21:02:47 +0000 Subject: Use separator during simplification --- test/html/simplify.tests.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/html/simplify.tests.js') diff --git a/test/html/simplify.tests.js b/test/html/simplify.tests.js index 50593ee..cec4dc5 100644 --- a/test/html/simplify.tests.js +++ b/test/html/simplify.tests.js @@ -103,6 +103,22 @@ test("empty elements are removed before collapsing", function() { ); }); +test("when separator is present then separator is prepended to collapsed element", function() { + var unseparatedPath = htmlPaths.elements([ + htmlPaths.element("pre", {}, {fresh: false}) + ]); + var separatedPath = htmlPaths.elements([ + htmlPaths.element("pre", {}, {fresh: false, separator: "\n"}) + ]); + assert.deepEqual( + html.simplify(concat( + pathToNodes(unseparatedPath, [text("Hello")]), + pathToNodes(separatedPath, [text(" the"), text("re")]) + )), + pathToNodes(unseparatedPath, [text("Hello"), text("\n"), text(" the"), text("re")]) + ); +}); + function simplifyNode(node) { return html.simplify([node]); } -- cgit v1.2.3