From 165c22a6c3afa563054ee17abff100250f21ac46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Mon, 2 Jul 2018 13:08:08 +0200 Subject: [PATCH 1/2] Restored 'withChildren: false' param inside the 'renderer._updateChildrenMappings()' method. --- src/view/renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/renderer.js b/src/view/renderer.js index 05af38295..a16adc5a2 100644 --- a/src/view/renderer.js +++ b/src/view/renderer.js @@ -256,7 +256,7 @@ export default class Renderer { const actualDomChildren = this.domConverter.mapViewToDom( viewElement ).childNodes; const expectedDomChildren = Array.from( - this.domConverter.viewChildrenToDom( viewElement, domElement.ownerDocument ) + this.domConverter.viewChildrenToDom( viewElement, domElement.ownerDocument, { withChildren: false } ) ); const diff = this._diffNodeLists( actualDomChildren, expectedDomChildren ); const actions = this._findReplaceActions( diff, actualDomChildren, expectedDomChildren ); From fde59715e6a17ea0b14f90ba6ff63e0158853a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Mon, 2 Jul 2018 13:12:20 +0200 Subject: [PATCH 2/2] Tests: unit test for 'DomConverter' modyfing DOM structure. --- tests/view/renderer.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/view/renderer.js b/tests/view/renderer.js index 7e6600138..d9fdbf668 100644 --- a/tests/view/renderer.js +++ b/tests/view/renderer.js @@ -1683,6 +1683,36 @@ describe( 'Renderer', () => { ); } ); + // #1451 + it( 'should correctly render changed children even if direct parent is not marked to sync', () => { + const inputView = + '' + + 'Foo' + + 'Bar' + + ''; + + const view = parse( inputView ); + + viewRoot._appendChild( view ); + + renderer.markToSync( 'children', viewRoot ); + renderer.render(); + + expect( domRoot.innerHTML ).to.equal( '' ); + + const viewLi = view.getChild( 0 ); + const viewLiIndented = view._removeChildren( 1, 1 ); // Array with one element. + viewLiIndented[ 0 ]._appendChild( parse( 'Baz' ) ); + const viewUl = new ViewContainerElement( 'ul', null, viewLiIndented ); + viewLi._appendChild( viewUl ); + + renderer.markToSync( 'children', view ); + renderer.markToSync( 'children', viewLi ); + renderer.render(); + + expect( domRoot.innerHTML ).to.equal( '' ); + } ); + describe( 'fake selection', () => { beforeEach( () => { const { view: viewP, selection: newSelection } = parse(