Open dzyhenry opened 6 years ago
When I change the 'keys' test case as follows, the 'getReorderPatch' function doesn't work, because the patch returned from 'diff' is an Array.
test("keys get reordered", function (assert) { var leftNode = h("div", [ h("div"), h("div", { key: 1 }), h("div"), h("div", { key: 2 }), ]) var rightNode = h("div", [ h("div", { key: 1 }), h("div"), h("div", { key: 3 }), h("div"), ]); var rootNode = render(leftNode) var patches = diff(leftNode, rightNode) assert.equal(patchCount(patches), 2) assertReorderEquals(assert, patches, { removes: [ {from: 1, key: '1' }, {from: 2, key: null }, {from: 2, key: '3' }, ], inserts: [ {to: 0, key: '1' }, {to: 2, key: '3' }, ] }) })
When I change the 'keys' test case as follows, the 'getReorderPatch' function doesn't work, because the patch returned from 'diff' is an Array.