8
0
Szymon Kupś 8 лет назад
Родитель
Сommit
f65dad3062

+ 7 - 0
packages/ckeditor5-engine/src/view/uielement.js

@@ -64,6 +64,13 @@ export default class UIElement extends Element {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * Renders this {@link module:engine/view/uielement~UIElement} to DOM. This method is called by
+	 * {@link engine/view/domconverter~DomConverter}.
+	 *
+	 * @param {Document} domDocument
+	 * @return {HTMLElement}
+	 */
 	render( domDocument ) {
 	render( domDocument ) {
 		const domElement = domDocument.createElement( this.name );
 		const domElement = domDocument.createElement( this.name );
 
 

+ 24 - 0
packages/ckeditor5-engine/tests/view/uielement.js

@@ -3,6 +3,8 @@
  * For licensing, see LICENSE.md.
  * For licensing, see LICENSE.md.
  */
  */
 
 
+/* global document, HTMLElement */
+
 import UIElement from '../../src/view/uielement';
 import UIElement from '../../src/view/uielement';
 import Element from '../../src/view/element';
 import Element from '../../src/view/element';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
@@ -99,4 +101,26 @@ describe( 'UIElement', () => {
 			expect( uiElement.getFillerOffset() ).to.null;
 			expect( uiElement.getFillerOffset() ).to.null;
 		} );
 		} );
 	} );
 	} );
+
+	describe( 'render()', () => {
+		let domElement;
+
+		beforeEach( () => {
+			domElement = uiElement.render( document );
+		} );
+
+		it( 'should return DOM element', () => {
+			expect( domElement ).to.be.instanceOf( HTMLElement );
+		} );
+
+		it( 'should use element name', () => {
+			expect( domElement.tagName.toLowerCase() ).to.equal( uiElement.name );
+		} );
+
+		it( 'should render attributes', () => {
+			for ( const key of uiElement.getAttributeKeys() ) {
+				expect( domElement.getAttribute( key ) ).to.equal( uiElement.getAttribute( key ) );
+			}
+		} );
+	} );
 } );
 } );