Selaa lähdekoodia

Minor improvements for the manual test.

Kamil Piechaczek 7 vuotta sitten
vanhempi
sitoutus
0ae222694b

+ 1 - 1
packages/ckeditor5-editor-inline/tests/manual/inlineeditor-data.html

@@ -1,5 +1,5 @@
 <p>
 <p>
-	<button id="destroyEditor">Destroy editor</button>
+	<button id="destroyEditors">Destroy editors</button>
 	<button id="initEditor">Init editor</button>
 	<button id="initEditor">Init editor</button>
 </p>
 </p>
 
 

+ 7 - 4
packages/ckeditor5-editor-inline/tests/manual/inlineeditor-data.js

@@ -9,16 +9,17 @@ import InlineEditor from '../../src/inlineeditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
 
 
 window.editors = [];
 window.editors = [];
-
 const container = document.querySelector( '.container' );
 const container = document.querySelector( '.container' );
+let counter = 1;
 
 
 function initEditor() {
 function initEditor() {
 	InlineEditor
 	InlineEditor
-		.create( '<h2>Editor 1</h2><p>This is an editor instance.</p>', {
+		.create( `<h2>Editor ${ counter }</h2><p>This is an editor instance.</p>`, {
 			plugins: [ ArticlePluginSet ],
 			plugins: [ ArticlePluginSet ],
 			toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
 			toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
 		} )
 		} )
 		.then( editor => {
 		.then( editor => {
+			counter += 1;
 			window.editors.push( editor );
 			window.editors.push( editor );
 			container.appendChild( editor.element );
 			container.appendChild( editor.element );
 		} )
 		} )
@@ -27,14 +28,16 @@ function initEditor() {
 		} );
 		} );
 }
 }
 
 
-function destroyEditor() {
+function destroyEditors() {
 	window.editors.forEach( editor => {
 	window.editors.forEach( editor => {
 		editor.destroy()
 		editor.destroy()
 			.then( () => {
 			.then( () => {
 				editor.element.remove();
 				editor.element.remove();
 			} );
 			} );
 	} );
 	} );
+	window.editors = [];
+	counter = 1;
 }
 }
 
 
 document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
 document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
-document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );
+document.getElementById( 'destroyEditors' ).addEventListener( 'click', destroyEditors );

+ 1 - 1
packages/ckeditor5-editor-inline/tests/manual/inlineeditor-data.md

@@ -1,3 +1,3 @@
 1. Click "Init editor".
 1. Click "Init editor".
-2. New editor instance should be appended to the document with initial data in it.
+2. New editor instance should be appended to the document with initial data in it. You can create more than one editor.
 3. After clicking "Destroy editor" all editors should be removed from the document.
 3. After clicking "Destroy editor" all editors should be removed from the document.