@@ -563,7 +563,17 @@ test('unist-diff', function (t) {
563563 st . deepEqual (
564564 diff ( left , right ) ,
565565 {
566- 0 : { type : 'insert' , left : null , right : one } ,
566+ 0 : [
567+ { type : 'insert' , left : null , right : one } ,
568+ {
569+ type : 'order' ,
570+ left : left ,
571+ right : {
572+ removes : [ { left : one , right : 2 } ] ,
573+ inserts : [ { left : one , right : 0 } ]
574+ }
575+ }
576+ ] ,
567577 left : left
568578 } ,
569579 'should return an `insert` if a child is prepended'
@@ -582,7 +592,15 @@ test('unist-diff', function (t) {
582592 {
583593 0 : [
584594 { type : 'insert' , left : null , right : one } ,
585- { type : 'insert' , left : null , right : two }
595+ { type : 'insert' , left : null , right : two } ,
596+ {
597+ type : 'order' ,
598+ left : left ,
599+ right : {
600+ removes : [ { left : three , right : 0 } ] ,
601+ inserts : [ { left : three , right : 2 } ]
602+ }
603+ }
586604 ] ,
587605 left : left
588606 } ,
@@ -600,7 +618,17 @@ test('unist-diff', function (t) {
600618 st . deepEqual (
601619 diff ( left , right ) ,
602620 {
603- 0 : { type : 'insert' , left : null , right : two } ,
621+ 0 : [
622+ { type : 'insert' , left : null , right : { type : 'bravo' } } ,
623+ {
624+ type : 'order' ,
625+ left : left ,
626+ right : {
627+ removes : [ { left : two , right : 2 } ] ,
628+ inserts : [ { left : two , right : 1 } ]
629+ }
630+ }
631+ ] ,
604632 left : left
605633 } ,
606634 'should return an `insert` if a child is injected'
@@ -620,7 +648,15 @@ test('unist-diff', function (t) {
620648 {
621649 0 : [
622650 { type : 'insert' , left : null , right : two } ,
623- { type : 'insert' , left : null , right : three }
651+ { type : 'insert' , left : null , right : three } ,
652+ {
653+ type : 'order' ,
654+ left : left ,
655+ right : {
656+ removes : [ { left : four , right : 1 } ] ,
657+ inserts : [ { left : four , right : 3 } ]
658+ }
659+ }
624660 ] ,
625661 left : left
626662 } ,
@@ -774,8 +810,8 @@ test('unist-diff', function (t) {
774810 type : 'order' ,
775811 left : left ,
776812 right : {
777- removes : [ { from : 2 , left : charlie , right : charlie } ] ,
778- inserts : [ { left : charlie , right : charlie , to : 0 } ]
813+ removes : [ { left : charlie , right : 2 } ] ,
814+ inserts : [ { left : charlie , right : 0 } ]
779815 }
780816 } ,
781817 left : left
@@ -798,8 +834,8 @@ test('unist-diff', function (t) {
798834 type : 'order' ,
799835 left : left ,
800836 right : {
801- removes : [ { from : 2 , left : alpha , right : alpha } ] ,
802- inserts : [ { left : alpha , right : alpha , to : 0 } ]
837+ removes : [ { left : alpha , right : 0 } ] ,
838+ inserts : [ { left : alpha , right : 2 } ]
803839 }
804840 } ,
805841 left : left
@@ -823,12 +859,12 @@ test('unist-diff', function (t) {
823859 left : left ,
824860 right : {
825861 removes : [
826- { from : 1 , left : bravo , right : bravo } ,
827- { from : 2 , left : alpha , right : alpha }
862+ { left : bravo , right : 1 } ,
863+ { left : charlie , right : 2 }
828864 ] ,
829865 inserts : [
830- { to : 0 , left : alpha , right : alpha } ,
831- { to : 1 , left : bravo , right : bravo }
866+ { left : charlie , right : 0 } ,
867+ { left : bravo , right : 1 }
832868 ]
833869 }
834870 } ,
@@ -854,13 +890,13 @@ test('unist-diff', function (t) {
854890 type : 'order' ,
855891 left : alphaOne ,
856892 right : {
857- inserts : [
858- { left : bravo , right : bravo , to : 0 } ,
859- { left : charlie , right : charlie , to : 1 }
860- ] ,
861893 removes : [
862- { from : 1 , left : charlie , right : charlie } ,
863- { from : 2 , left : bravo , right : bravo }
894+ { left : charlie , right : 1 } ,
895+ { left : delta , right : 2 }
896+ ] ,
897+ inserts : [
898+ { left : delta , right : 0 } ,
899+ { left : charlie , right : 1 }
864900 ]
865901 }
866902 } ,
@@ -886,13 +922,13 @@ test('unist-diff', function (t) {
886922 type : 'order' ,
887923 left : alphaOne ,
888924 right : {
889- inserts : [
890- { left : bravo , right : bravo , to : 0 } ,
891- { left : charlie , right : charlie , to : 1 }
892- ] ,
893925 removes : [
894- { from : 1 , left : charlie , right : charlie } ,
895- { from : 2 , left : bravo , right : bravo }
926+ { left : charlie , right : 1 } ,
927+ { left : delta , right : 2 }
928+ ] ,
929+ inserts : [
930+ { left : delta , right : 0 } ,
931+ { left : charlie , right : 1 }
896932 ]
897933 }
898934 } ,
0 commit comments