Skip to content

Commit fbc1165

Browse files
committed
Add my findSoftMatch test
1 parent 4658ec5 commit fbc1165

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/ops.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,25 @@ describe("morphing operations", function () {
167167
],
168168
);
169169
});
170+
171+
it("Show SoftMatch aborting on two future soft matches", function () {
172+
// when nodes can't be softMatched because they have different types it will scan ahead
173+
// but it aborts the scan ahead if it finds two nodes ahead in both the new and old content
174+
// that softmatch so it can just insert the mis matched node it is on and get to the matching.
175+
assertOps(
176+
"<section><h1></h1><h2></h2><div></div></section>",
177+
"<section><div>Alert</div><h1></h1><h2></h2><div></div></section>",
178+
[
179+
[
180+
"Morphed",
181+
"<section><h1></h1><h2></h2><div></div></section>",
182+
"<section><div>Alert</div><h1></h1><h2></h2><div></div></section>",
183+
],
184+
["Added", "<div>Alert</div>"],
185+
["Morphed", "<h1></h1>", "<h1></h1>"],
186+
["Morphed", "<h2></h2>", "<h2></h2>"],
187+
["Morphed", "<div></div>", "<div></div>"],
188+
],
189+
);
190+
});
170191
});

0 commit comments

Comments
 (0)