Browse Source

Aligned ListItemView to the View#render API.

Aleksander Nowodzinski 8 years ago
parent
commit
733cfca621

+ 4 - 3
packages/ckeditor5-ui/src/list/listitemview.js

@@ -8,7 +8,6 @@
  */
 
 import View from '../view';
-import Template from '../template';
 import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
 
 /**
@@ -42,7 +41,7 @@ export default class ListItemView extends View {
 
 		const bind = this.bindTemplate;
 
-		this.template = new Template( {
+		this.setTemplate( {
 			tag: 'li',
 
 			attributes: {
@@ -104,7 +103,9 @@ export default class ListItemView extends View {
 	/**
 	 * @inheritDoc
 	 */
-	init() {
+	render() {
+		super.render();
+
 		const onKeystrokePress = ( data, cancel ) => {
 			this.fire( 'execute' );
 			cancel();

+ 5 - 3
packages/ckeditor5-ui/tests/list/listitemview.js

@@ -18,7 +18,7 @@ describe( 'ListItemView', () => {
 			label: 'bar'
 		} );
 
-		return view.init();
+		return view.render();
 	} );
 
 	describe( 'constructor()', () => {
@@ -31,11 +31,13 @@ describe( 'ListItemView', () => {
 		} );
 	} );
 
-	describe( 'init()', () => {
+	describe( 'render()', () => {
 		it( 'starts listening for #keystrokes coming from #element', () => {
+			view = new ListItemView();
+
 			const spy = sinon.spy( view.keystrokes, 'listenTo' );
 
-			view.init();
+			view.render();
 			sinon.assert.calledOnce( spy );
 			sinon.assert.calledWithExactly( spy, view.element );
 		} );