File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments