diff --git a/tests/view/renderer.js b/tests/view/renderer.js index 23c2d80f5..b6e5ca091 100644 --- a/tests/view/renderer.js +++ b/tests/view/renderer.js @@ -12,6 +12,7 @@ import ViewAttributeElement from '../../src/view/attributeelement'; import ViewText from '../../src/view/text'; import ViewRange from '../../src/view/range'; import ViewPosition from '../../src/view/position'; +import UIElement from '../../src/view/uielement'; import DocumentSelection from '../../src/view/documentselection'; import DomConverter from '../../src/view/domconverter'; import Renderer from '../../src/view/renderer'; @@ -2948,6 +2949,40 @@ describe( 'Renderer', () => { '
  • Ba1 Ba3 ' + 'Ba2
  • ' ) ); } ); + + it( 'should handle uiElement rendering', () => { + function createUIElement( id, text ) { + const element = new UIElement( 'span' ); + element.render = function( domDocument ) { + const domElement = this.toDomElement( domDocument ); + domElement.innerText = `${ text }`; + return domElement; + }; + + return element; + } + + const ui1 = createUIElement( 'id1', 'UI1' ); + const ui2 = createUIElement( 'id2', 'UI2' ); + const viewP = new ViewContainerElement( 'p', null, [ new ViewText( 'Foo ' ), ui1, new ViewText( 'Bar' ) ] ); + viewRoot._appendChild( viewP ); + + renderer.markToSync( 'children', viewRoot ); + renderer.render(); + + expect( normalizeHtml( domRoot.innerHTML ) ).to.equal( normalizeHtml( + '

    Foo UI1Bar

    ' ) ); + + viewP._removeChildren( 0, viewP.childCount ); + viewP._insertChild( 0, [ new ViewText( 'Foo' ), ui2, new ViewText( ' Bar' ) ] ); + + renderer.markToSync( 'children', viewRoot ); + renderer.markToSync( 'children', viewP ); + renderer.render(); + + expect( normalizeHtml( domRoot.innerHTML ) ).to.equal( normalizeHtml( + '

    FooUI2 Bar

    ' ) ); + } ); } ); } );