Explorar el Código

Tests: added manual test for #603.

Piotrek Koszuliński hace 9 años
padre
commit
6a138d1c2c

+ 8 - 0
packages/ckeditor5-engine/tests/tickets/603/1.html

@@ -0,0 +1,8 @@
+<head>
+	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/modules/amd/theme/ckeditor.css">
+</head>
+
+<div id="editor">
+	<h2>Foo <em>bar</em></h2>
+	<p>Lorem <strong><em>ips</em>um</strong> dolor <strong>sit</strong> amet.</p>
+</div>

+ 26 - 0
packages/ckeditor5-engine/tests/tickets/603/1.js

@@ -0,0 +1,26 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '/ckeditor5/editor-classic/classic.js';
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	features: [ 'enter', 'typing', 'paragraph', 'heading', 'basic-styles/bold', 'basic-styles/italic' ],
+	toolbar: [ 'headings', 'bold', 'italic' ]
+} )
+.then( editor => {
+	window.editor = editor;
+
+	const sel = editor.document.selection;
+
+	sel.on( 'change', ( evt, data ) => {
+		const date = new Date();
+		console.log( `${ date.getSeconds() }s${ String( date.getMilliseconds() ).slice( 0, 2 ) }ms`, evt.name, data );
+	} );
+} )
+.catch( err => {
+	console.error( err.stack );
+} );

+ 17 - 0
packages/ckeditor5-engine/tests/tickets/603/1.md

@@ -0,0 +1,17 @@
+@bender-ui: collapsed
+@bender-tags: ticket, 603, iteration4
+
+### Selection events test [#603](https://github.com/ckeditor/ckeditor5-engine/issues/603)
+
+Test that each selection change fires:
+
+* only one `change:range` for position change.
+* only one `change:attribute` for attribute(s) change (if anything has changed).
+
+Test following ways of changing selection:
+
+* clicking in various positions,
+* arrow keys,
+* applying styles,
+* enter and backspace keys,
+* typing.