Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Minor improvements for the manual test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Jun 5, 2018
1 parent 7deea17 commit f77d8a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/manual/ballooneditor-data.html
@@ -1,5 +1,5 @@
<p>
<button id="destroyEditor">Destroy editor</button>
<button id="destroyEditors">Destroy editors</button>
<button id="initEditor">Init editor</button>
</p>

Expand Down
10 changes: 7 additions & 3 deletions tests/manual/ballooneditor-data.js
Expand Up @@ -10,14 +10,16 @@ import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articleplugi

window.editors = [];
const container = document.querySelector( '.container' );
let counter = 1;

function initEditor() {
BalloonEditor
.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 ],
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
} )
.then( editor => {
counter += 1;
window.editors.push( editor );
container.appendChild( editor.element );
} )
Expand All @@ -26,14 +28,16 @@ function initEditor() {
} );
}

function destroyEditor() {
function destroyEditors() {
window.editors.forEach( editor => {
editor.destroy()
.then( () => {
editor.element.remove();
} );
} );
window.editors = [];
counter = 1;
}

document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );
document.getElementById( 'destroyEditors' ).addEventListener( 'click', destroyEditors );
4 changes: 2 additions & 2 deletions tests/manual/ballooneditor-data.md
@@ -1,3 +1,3 @@
1. Click "Init editor".
2. New editor instance should be appended to the document with initial data in it.
3. After clicking "Destroy editor" all editors should be removed from the document.
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 editors" all editors should be removed from the document.

0 comments on commit f77d8a6

Please sign in to comment.