Skip to content

Commit

Permalink
Add my findSoftMatch test
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelWest22 committed Jan 26, 2025
1 parent 4658ec5 commit fbc1165
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,25 @@ describe("morphing operations", function () {
],
);
});

it("Show SoftMatch aborting on two future soft matches", function () {
// when nodes can't be softMatched because they have different types it will scan ahead
// but it aborts the scan ahead if it finds two nodes ahead in both the new and old content
// that softmatch so it can just insert the mis matched node it is on and get to the matching.
assertOps(
"<section><h1></h1><h2></h2><div></div></section>",
"<section><div>Alert</div><h1></h1><h2></h2><div></div></section>",
[
[
"Morphed",
"<section><h1></h1><h2></h2><div></div></section>",
"<section><div>Alert</div><h1></h1><h2></h2><div></div></section>",
],
["Added", "<div>Alert</div>"],
["Morphed", "<h1></h1>", "<h1></h1>"],
["Morphed", "<h2></h2>", "<h2></h2>"],
["Morphed", "<div></div>", "<div></div>"],
],
);
});
});

0 comments on commit fbc1165

Please sign in to comment.