aboutsummaryrefslogtreecommitdiff
path: root/tests/html
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-10-13 22:14:41 +0100
committerMichael Williamson <mike@zwobble.org>2015-10-13 22:14:41 +0100
commite04d054a1b414e843fa6d6f5ee1ae75c0df533b1 (patch)
tree4e6acf783e9ec47bbd47da9a7cc87e8093177209 /tests/html
parentaac776b1711d1e286812035a28108c622e73994a (diff)
Reuse matchesElement from HTML paths
Diffstat (limited to 'tests/html')
-rw-r--r--tests/html/simplify.tests.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/html/simplify.tests.js b/tests/html/simplify.tests.js
index 7893663..7e17903 100644
--- a/tests/html/simplify.tests.js
+++ b/tests/html/simplify.tests.js
@@ -33,4 +33,17 @@ describe("simplify", function() {
fragment([
pathToNode(path, [text("Hello"), text(" there")])]));
});
+
+ test("non-fresh can collapse into preceding non-fresh element", function() {
+ var freshPath = htmlPaths.elements([
+ htmlPaths.element("p", {}, {fresh: true})]);
+ var nonFreshPath = htmlPaths.elements([
+ htmlPaths.element("p", {}, {fresh: false})]);
+ assert.deepEqual(
+ html.simplify(fragment([
+ pathToNode(freshPath, [text("Hello")]),
+ pathToNode(nonFreshPath, [text(" there")])])),
+ fragment([
+ pathToNode(freshPath, [text("Hello"), text(" there")])]));
+ });
});