@@ -1636,7 +1636,9 @@ describe('render()', () => {
16361636 ) ;
16371637 const a = [ '0' , '1' , '2' , '3' , '4' , '5' , '6' ] ;
16381638 const b = [ '1' , '3' , '5' , '2' , '6' , '4' , '0' ] ;
1639+ const c = [ '11' , '3' , '1' , '4' , '6' , '2' , '5' , '0' , '9' , '10' ] ;
16391640 render ( < App items = { a } /> , scratch ) ;
1641+ clearLog ( ) ;
16401642 expect ( scratch . innerHTML ) . to . equal (
16411643 `<div>${ a . map ( n => `<div>${ n } </div>` ) . join ( '' ) } </div>`
16421644 ) ;
@@ -1645,10 +1647,46 @@ describe('render()', () => {
16451647 expect ( scratch . innerHTML ) . to . equal (
16461648 `<div>${ b . map ( n => `<div>${ n } </div>` ) . join ( '' ) } </div>`
16471649 ) ;
1650+ expect ( getLog ( ) ) . to . deep . equal ( [
1651+ '<div>0123456.insertBefore(<div>2, <div>6)' ,
1652+ '<div>0134526.appendChild(<div>4)' ,
1653+ '<div>0135264.appendChild(<div>0)'
1654+ ] ) ;
1655+ clearLog ( ) ;
1656+
1657+ render ( < App items = { c } /> , scratch ) ;
1658+ expect ( scratch . innerHTML ) . to . equal (
1659+ `<div>${ c . map ( n => `<div>${ n } </div>` ) . join ( '' ) } </div>`
1660+ ) ;
1661+ expect ( getLog ( ) ) . to . deep . equal ( [
1662+ '<div>.appendChild(#text)' ,
1663+ '<div>1352640.insertBefore(<div>11, <div>1)' ,
1664+ '<div>111352640.insertBefore(<div>1, <div>5)' ,
1665+ '<div>113152640.insertBefore(<div>6, <div>0)' ,
1666+ '<div>113152460.insertBefore(<div>2, <div>0)' ,
1667+ '<div>113154620.insertBefore(<div>5, <div>0)' ,
1668+ '<div>.appendChild(#text)' ,
1669+ '<div>113146250.appendChild(<div>9)' ,
1670+ '<div>.appendChild(#text)' ,
1671+ '<div>1131462509.appendChild(<div>10)'
1672+ ] ) ;
1673+ clearLog ( ) ;
16481674
16491675 render ( < App items = { a } /> , scratch ) ;
16501676 expect ( scratch . innerHTML ) . to . equal (
16511677 `<div>${ a . map ( n => `<div>${ n } </div>` ) . join ( '' ) } </div>`
16521678 ) ;
1679+ expect ( getLog ( ) ) . to . deep . equal ( [
1680+ '<div>11.remove()' ,
1681+ '<div>9.remove()' ,
1682+ '<div>10.remove()' ,
1683+ '<div>3146250.appendChild(<div>1)' ,
1684+ '<div>3462501.appendChild(<div>2)' ,
1685+ '<div>3465012.appendChild(<div>3)' ,
1686+ '<div>4650123.appendChild(<div>4)' ,
1687+ '<div>6501234.appendChild(<div>5)' ,
1688+ '<div>6012345.appendChild(<div>6)'
1689+ ] ) ;
1690+ clearLog ( ) ;
16531691 } ) ;
16541692} ) ;
0 commit comments