aboutsummaryrefslogtreecommitdiff
path: root/test/html
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-11-14 21:02:47 +0000
committerMichael Williamson <mike@zwobble.org>2016-11-14 21:07:30 +0000
commitfba50901e45483a339a16334b628271f770baddf (patch)
tree17c80a2959f8d2bca25fa19e3d890a7862f4dc81 /test/html
parent443ad6fcbef7734e8b91d8082a0583ce2165c446 (diff)
Use separator during simplification
Diffstat (limited to 'test/html')
-rw-r--r--test/html/simplify.tests.js16
1 files changed, 16 insertions, 0 deletions
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]);
}