Skip to content

Commit 4c088ab

Browse files
tests for smart soft matching during common mutations.
1 parent c7bc079 commit 4c088ab

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

test/ops.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,57 @@ describe("morphing operations", function () {
6060
],
6161
);
6262
});
63+
64+
it("gracefully handling shifting a new softmatchable node into the front", function () {
65+
assertOps(
66+
"<section><div></div><div></div></section>",
67+
"<section><div>New</div><div></div><div></div></section>",
68+
[
69+
[
70+
"Morphed",
71+
"<section><div></div><div></div></section>",
72+
"<section><div>New</div><div></div><div></div></section>",
73+
],
74+
["Added", "<div>New</div>"],
75+
["Morphed", "<div></div>", "<div></div>"],
76+
["Morphed", "<div></div>", "<div></div>"],
77+
],
78+
);
79+
});
80+
81+
it("gracefully handling inserting a node softmatchable into the middle", function () {
82+
assertOps(
83+
"<section><div></div><div></div><div></div><div></div></section>",
84+
"<section><div></div><div></div><div>New</div><div></div><div></div></section>",
85+
[
86+
[
87+
"Morphed",
88+
"<section><div></div><div></div><div></div><div></div></section>",
89+
"<section><div></div><div></div><div>New</div><div></div><div></div></section>",
90+
],
91+
["Morphed", "<div></div>", "<div></div>"],
92+
["Morphed", "<div></div>", "<div></div>"],
93+
["Added", "<div>New</div>"],
94+
["Morphed", "<div></div>", "<div></div>"],
95+
["Morphed", "<div></div>", "<div></div>"],
96+
],
97+
);
98+
});
99+
100+
it("gracefully handling pushing a new node softmatchable onto the end", function () {
101+
assertOps(
102+
"<section><div></div><div></div></section>",
103+
"<section><div></div><div></div><div>New</div></section>",
104+
[
105+
[
106+
"Morphed",
107+
"<section><div></div><div></div></section>",
108+
"<section><div></div><div></div><div>New</div></section>",
109+
],
110+
["Morphed", "<div></div>", "<div></div>"],
111+
["Morphed", "<div></div>", "<div></div>"],
112+
["Added", "<div>New</div>"],
113+
],
114+
);
115+
});
63116
});

0 commit comments

Comments
 (0)