Browse Source

Removed test cases for plugins from other repo than ui.

Oskar Wróbel 8 years ago
parent
commit
6bd2b1a349

+ 10 - 15
packages/ckeditor5-ui/tests/manual/tickets/198/1.html

@@ -1,19 +1,14 @@
-<h2>Contextual Toolbar:</h2>
-<p><button id="button-ct">Start external changes</button></p>
-<div id="editor-ct">
-	<p>EXTERNAL CHANGES WILL START HERE -> This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-</div>
+<h2>External changes (insert)</h2>
 
-<h2>Link:</h2>
-<p><button id="button-link">Start external changes</button></p>
-<div id="editor-link">
-	<p>EXTERNAL CHANGES WILL START HERE -> This specification <a href="http://ckeditor.com">defines the 5th</a> major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
+<p><button id="button-insert">Start external changes</button></p>
+<div id="editor-insert">
+	<p>EXTERNAL CHANGES WILL START HERE -> This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
 </div>
 
-<h2>Image toolbar:</h2>
-<p><button id="button-image-toolbar">Start external changes</button></p>
-<div id="editor-image-toolbar">
-	<p>EXTERNAL CHANGES WILL START HERE -> This specification defines the 5th major revision of the core language</p>
-	<figure class="image"><img src="sample.jpg" alt="CKEditor logo" /></figure>
-	<p>of the World Wide Web: the Hypertext Markup Language (HTML).</p>
+<h2>External changes (delete)</h2>
+<p><button id="button-delete">Start external changes</button></p>
+<div id="editor-delete">
+	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
+	<p>THIS PARAGRAPH WILL BE REMOVED This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
+	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
 </div>

+ 41 - 40
packages/ckeditor5-ui/tests/manual/tickets/198/1.js

@@ -12,66 +12,57 @@ import ContextualToolbar from '../../../../src/toolbar/contextual/contextualtool
 import Element from '@ckeditor/ckeditor5-engine/src/model/element';
 import Text from '@ckeditor/ckeditor5-engine/src/model/text';
 import Position from '@ckeditor/ckeditor5-engine/src/model/position';
+import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 
-// Editor for the ContextualToolbar plugin.
-ClassicEditor.create( document.querySelector( '#editor-ct' ), {
+// Editor for the external insert.
+ClassicEditor.create( document.querySelector( '#editor-insert' ), {
 	plugins: [ ArticlePresets, ContextualToolbar ],
 	toolbar: [ 'undo', 'redo' ],
 	contextualToolbar: [ 'bold', 'italic' ]
 } )
 .then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-ct' ) );
-} )
-.catch( err => console.error( err.stack ) );
+	const element = document.querySelector( '#button-insert' );
 
-// Editor for the Link plugin.
-ClassicEditor.create( document.querySelector( '#editor-link' ), {
-	plugins: [ ArticlePresets ],
-	toolbar: [ 'undo', 'redo', 'link' ],
-	contextualToolbar: [ 'bold', 'italic' ]
-} )
-.then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-link' ) );
+	element.addEventListener( 'click', () => {
+		element.disabled = true;
+		startExternalInsert( editor );
+	} );
 } )
 .catch( err => console.error( err.stack ) );
 
-// Editor for the Link plugin.
-ClassicEditor.create( document.querySelector( '#editor-image-toolbar' ), {
-	plugins: [ ArticlePresets ],
+// Editor for the external delete.
+ClassicEditor.create( document.querySelector( '#editor-delete' ), {
+	plugins: [ ArticlePresets, ContextualToolbar ],
 	toolbar: [ 'undo', 'redo' ],
-	image: {
-		toolbar: [ 'imageStyleFull', 'imageStyleSide', '|' , 'imageTextAlternative' ]
-	}
+	contextualToolbar: [ 'bold', 'italic' ]
 } )
 .then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-image-toolbar' ) );
-} )
-.catch( err => console.error( err.stack ) );
+	const element = document.querySelector( '#button-delete' );
 
-export function initExternalChangesHandler( editor, element ) {
 	element.addEventListener( 'click', () => {
 		element.disabled = true;
-		startExternalChanges( editor );
+		startExternalDelete( editor );
+	} );
+} )
+.catch( err => console.error( err.stack ) );
+
+function wait( delay ) {
+	return new Promise( ( resolve ) => {
+		setTimeout( () => resolve(), delay );
 	} );
 }
 
-function startExternalChanges( editor ) {
+function startExternalInsert( editor ) {
 	const document = editor.document;
 	const bath = document.batch( 'transparent' );
 
-	function wait( delay ) {
-		return new Promise( ( resolve ) => {
-			setTimeout( () => resolve(), delay );
-		} );
-	}
-
 	function type( path, text ) {
 		return new Promise( ( resolve ) => {
 			let position = new Position( document.getRoot(), path );
 			let index = 0;
 
 			function typing() {
-				setTimeout( () => {
+				wait( 40 ).then( () => {
 					document.enqueueChanges( () => {
 						bath.insert( position, new Text( text[ index ] ) );
 						position = position.getShiftedBy( 1 );
@@ -85,7 +76,7 @@ function startExternalChanges( editor ) {
 							resolve();
 						}
 					} );
-				}, 40 );
+				} );
 			}
 
 			typing();
@@ -93,13 +84,12 @@ function startExternalChanges( editor ) {
 	}
 
 	function insertNewLine( path ) {
-		return new Promise( ( resolve ) => {
-			setTimeout( () => {
-				document.enqueueChanges( () => {
-					bath.insert( new Position( document.getRoot(), path ), new Element( 'paragraph' ) );
-					resolve();
-				} );
-			}, 200 );
+		return wait( 200 ).then( () => {
+			document.enqueueChanges( () => {
+				bath.insert( new Position( document.getRoot(), path ), new Element( 'paragraph' ) );
+			} );
+
+			return Promise.resolve();
 		} );
 	}
 
@@ -114,3 +104,14 @@ function startExternalChanges( editor ) {
 		.then( () => insertNewLine( [ 0 ] ) )
 		.then( () => type( [ 0, 0 ], 'DONE :)' ) );
 }
+
+function startExternalDelete( editor, deleteData = [ [ 1 ], 1 ] ) {
+	const document = editor.document;
+	const bath = document.batch( 'transparent' );
+
+	wait( 3000 ).then( () => {
+		document.enqueueChanges( () => {
+			bath.remove( Range.createFromPositionAndShift( new Position( document.getRoot(), [  ] ), deleteData[ 1 ] ) );
+		} );
+	} );
+}

+ 5 - 24
packages/ckeditor5-ui/tests/manual/tickets/198/1.md

@@ -1,33 +1,14 @@
 # Issue [#198](https://github.com/ckeditor/ckeditor5-ui/issues/198) manual test.
 
-## Position of balloons should be updated on external changes.
+## Position of the `ContextualToolbar` should be updated on external changes.
 
-### Contextual toolbar
+### Insert:
 
 1. Click `Start external changes` and quickly select some text after the place where external changes will star
 (contextual toolbar should appear).
 2. Observe if balloon is attached to the target selection.
 
-### Link #1
+### Delete:
 
-1. Click `Start external changes` and quickly click on link element to display Link balloon.
-2. Observe if balloon is attached to the target element.
-
-### Link #2
-
-1. Refresh test page.
-2. Click `Start external changes` and quickly select some text after the place where external changes will start and press
-toolbar link button (or `Cmd` + `K`) to display Link balloon.
-3. Observe if balloon is attached to the target selection.
-
-### Image toolbar #1
-
-1. Click `Start external changes` and quickly click on image element to display image toolbar.
-2. Observe if balloon is attached to the target element.
-
-### Image toolbar #2
-
-1. Refresh test page.
-2. Click `Start external changes` and quickly click on image element then choose alt component from toolbar
-to display Text alternative balloon.
-3. Observe if balloon is attached to the target element.
+1. Click `Start external changes` and quickly select some text in the second paragraph (contextual toolbar should appear).
+2. Check if balloon hide and there is no errors on the browser console.

+ 0 - 25
packages/ckeditor5-ui/tests/manual/tickets/198/2.html

@@ -1,25 +0,0 @@
-<h2>Contextual Toolbar:</h2>
-<p><button id="button-ct">Start external changes</button></p>
-<div id="editor-ct">
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-	<p>THIS PARAGRAPH WILL BE REMOVE This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-</div>
-
-<h2>Link:</h2>
-<p><button id="button-link">Start external changes</button></p>
-<div id="editor-link">
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-
-	<p>THIS PARAGRAPH WILL BE REMOVE This specification <a href="http://ckeditor.com">defines the 5th</a> major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-</div>
-
-<h2>Image toolbar:</h2>
-<p><button id="button-image-toolbar">Start external changes</button></p>
-<div id="editor-image-toolbar">
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-	<figure class="image"><img src="sample-to-delete.jpg" alt="CKEditor logo" /></figure>
-	<p>This specification defines the 5th major revision of the core language of the World Wide Web: the Hypertext Markup Language (HTML).</p>
-</div>

+ 0 - 66
packages/ckeditor5-ui/tests/manual/tickets/198/2.js

@@ -1,66 +0,0 @@
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* globals console:false, document, setTimeout */
-
-import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
-import ArticlePresets from '@ckeditor/ckeditor5-presets/src/article';
-import ContextualToolbar from '../../../../src/toolbar/contextual/contextualtoolbar';
-
-import Position from '@ckeditor/ckeditor5-engine/src/model/position';
-import Range from '@ckeditor/ckeditor5-engine/src/model/range';
-
-// Editor for the ContextualToolbar plugin.
-ClassicEditor.create( document.querySelector( '#editor-ct' ), {
-	plugins: [ ArticlePresets, ContextualToolbar ],
-	toolbar: [ 'undo', 'redo' ],
-	contextualToolbar: [ 'bold', 'italic' ]
-} )
-.then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-ct' ) );
-} )
-.catch( err => console.error( err.stack ) );
-
-// Editor for the Link plugin.
-ClassicEditor.create( document.querySelector( '#editor-link' ), {
-	plugins: [ ArticlePresets ],
-	toolbar: [ 'undo', 'redo', 'link' ],
-	contextualToolbar: [ 'bold', 'italic' ]
-} )
-.then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-link' ) );
-} )
-.catch( err => console.error( err.stack ) );
-
-// Editor for the Link plugin.
-ClassicEditor.create( document.querySelector( '#editor-image-toolbar' ), {
-	plugins: [ ArticlePresets ],
-	toolbar: [ 'undo', 'redo' ],
-	image: {
-		toolbar: [ 'imageStyleFull', 'imageStyleSide', '|' , 'imageTextAlternative' ]
-	}
-} )
-.then( editor => {
-	initExternalChangesHandler( editor, document.querySelector( '#button-image-toolbar' ) );
-} )
-.catch( err => console.error( err.stack ) );
-
-export function initExternalChangesHandler( editor, element, deleteData ) {
-	element.addEventListener( 'click', () => {
-		element.disabled = true;
-		startExternalDelete( editor, deleteData );
-	} );
-}
-
-function startExternalDelete( editor, deleteData = [ [ 1 ], 1 ] ) {
-	const document = editor.document;
-	const bath = document.batch( 'transparent' );
-
-	setTimeout( () => {
-		document.enqueueChanges( () => {
-			bath.remove( Range.createFromPositionAndShift( new Position( document.getRoot(), deleteData[ 0 ] ), deleteData[ 1 ] ) );
-		} );
-	}, 3000 );
-}

+ 0 - 31
packages/ckeditor5-ui/tests/manual/tickets/198/2.md

@@ -1,31 +0,0 @@
-# Issue [#198](https://github.com/ckeditor/ckeditor5-ui/issues/198) manual test.
-
-## Balloon should hide on external changes.
-
-### Contextual toolbar
-
-1. Click `Start external changes` and quickly select some text from second paragraph  (contextual toolbar should appear).
-2. Check if balloon hide and there is no errors on browser console.
-
-### Link #1
-
-1. Click `Start external changes` and quickly click on link element from second paragraph  to display Link balloon.
-2. Check if balloon hide and there is no errors on browser console.
-
-### Link #2
-
-1. Refresh test page.
-2. Click `Start external changes` and quickly select some text from second paragraph and press toolbar link button (or `Cmd` + `K`) to display Link balloon.
-2. Check if balloon hide and there is no errors on browser console.
-
-### Image toolbar #1
-
-1. Click `Start external changes` and quickly click on image element to display image toolbar.
-2. Check if balloon hide and there is no errors on browser console.
-
-### Image toolbar #2
-
-1. Refresh test page.
-2. Click `Start external changes` and quickly click on image element then choose alt component from toolbar
-to display Text alternative balloon.
-2. Check if balloon hide and there is no errors on browser console.

BIN
packages/ckeditor5-ui/tests/manual/tickets/198/sample-to-delete.jpg


BIN
packages/ckeditor5-ui/tests/manual/tickets/198/sample.jpg