Skip to content

Commit c3c4a69

Browse files
failing test to expose issue with newContent being attached while having siblings in outerHTML morph.
1 parent e02fa81 commit c3c4a69

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/core.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,4 +561,30 @@ describe("Core morphing tests", function () {
561561
Idiomorph.morph(initial.body, final.body);
562562
initial.body.outerHTML.should.equal(finalSrc);
563563
});
564+
565+
it("test pathlogical case of oldNode and newContent both being in the same document with siblings", function () {
566+
let context = make(`
567+
<div>
568+
<p>ignore me</p>
569+
<div>hello</div>
570+
<div>world</div>
571+
<p>ignore me</p>
572+
</div>
573+
`);
574+
575+
let [initial, final] = context.querySelectorAll("div");
576+
let ret = Idiomorph.morph(initial, final);
577+
initial.outerHTML.should.equal(final.outerHTML);
578+
ret.map((e) => e.outerHTML).should.eql([final.outerHTML]);
579+
context.outerHTML.should.equal(
580+
`
581+
<div>
582+
<p>ignore me</p>
583+
<div>world</div>
584+
<div>world</div>
585+
<p>ignore me</p>
586+
</div>
587+
`.trim(),
588+
);
589+
});
564590
});

0 commit comments

Comments
 (0)