Skip to content

Commit

Permalink
tests for smart soft matching during common mutations.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Jan 19, 2025
1 parent c7bc079 commit 719f66b
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,57 @@ describe("morphing operations", function () {
],
);
});

it("gracefully handling shifting a new softmatchable node into the front", function () {
assertOps(
"<section><div></div><div></div></section>",
"<section><div>New</div><div></div><div></div></section>",
[
[
"Morphed",
"<section><div></div><div></div></section>",
"<section><div>New</div><div></div><div></div></section>",
],
["Added", "<div>New</div>"],
["Morphed", "<div></div>", "<div></div>"],
["Morphed", "<div></div>", "<div></div>"],
],
);
});

it("gracefully handling inserting a new softmatchable node into the middle", function () {
assertOps(
"<section><div></div><div></div><div></div><div></div></section>",
"<section><div></div><div></div><div>New</div><div></div><div></div></section>",
[
[
"Morphed",
"<section><div></div><div></div><div></div><div></div></section>",
"<section><div></div><div></div><div>New</div><div></div><div></div></section>",
],
["Morphed", "<div></div>", "<div></div>"],
["Morphed", "<div></div>", "<div></div>"],
["Added", "<div>New</div>"],
["Morphed", "<div></div>", "<div></div>"],
["Morphed", "<div></div>", "<div></div>"],
],
);
});

it("gracefully handling pushing a new softmatchable node onto the end", function () {
assertOps(
"<section><div></div><div></div></section>",
"<section><div></div><div></div><div>New</div></section>",
[
[
"Morphed",
"<section><div></div><div></div></section>",
"<section><div></div><div></div><div>New</div></section>",
],
["Morphed", "<div></div>", "<div></div>"],
["Morphed", "<div></div>", "<div></div>"],
["Added", "<div>New</div>"],
],
);
});
});

0 comments on commit 719f66b

Please sign in to comment.