浏览代码

Tests: manual tests - new undo step on selection/attribute change.

Krzysztof Krztoń 8 年之前
父节点
当前提交
5c36a3888c

+ 4 - 0
packages/ckeditor5-typing/tests/manual/20/1.html

@@ -0,0 +1,4 @@
+<div id="editor">
+	<h2>Heading 1</h2>
+	<p><em>This</em> is an <strong>editor</strong> instance.</p>
+</div>

+ 31 - 0
packages/ckeditor5-typing/tests/manual/20/1.js

@@ -0,0 +1,31 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
+import Enter from '@ckeditor/ckeditor5-enter/src/enter';
+import Typing from '../../../src/typing';
+import Heading from '@ckeditor/ckeditor5-heading/src/heading';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+import Undo from '@ckeditor/ckeditor5-undo/src/undo';
+import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
+import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
+import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+
+window.setInterval( function() {
+	console.log( getData( window.editor.document ) );
+}, 3000 );
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	plugins: [ Enter, Typing, Paragraph, Undo, Bold, Italic, Heading ],
+	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 15 - 0
packages/ckeditor5-typing/tests/manual/20/1.md

@@ -0,0 +1,15 @@
+## New undo step on changing selection ([#20](https://github.com/ckeditor/ckeditor5-typing/issues/20))
+
+*Every selection change should create a new undo step.*
+
+**Check**:
+
+1. Type "aaa" in one place.
+1. Move selection to another.
+1. Type "bbb".
+1. Move selection to another place.
+1. Type "ccc".
+1. Undo 3 times.
+
+**Expected**:
+3 undo steps were created. It is possible to undo 3 times, each time 3 letters from steps 5, 3, 1 are undone.

+ 4 - 0
packages/ckeditor5-typing/tests/manual/21/1.html

@@ -0,0 +1,4 @@
+<div id="editor">
+	<h2>Heading 1</h2>
+	<p><em>This</em> is an <strong>editor</strong> instance.</p>
+</div>

+ 31 - 0
packages/ckeditor5-typing/tests/manual/21/1.js

@@ -0,0 +1,31 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
+import Enter from '@ckeditor/ckeditor5-enter/src/enter';
+import Typing from '../../../src/typing';
+import Heading from '@ckeditor/ckeditor5-heading/src/heading';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+import Undo from '@ckeditor/ckeditor5-undo/src/undo';
+import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
+import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
+import { getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+
+window.setInterval( function() {
+	console.log( getData( window.editor.document ) );
+}, 3000 );
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	plugins: [ Enter, Typing, Paragraph, Undo, Bold, Italic, Heading ],
+	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 18 - 0
packages/ckeditor5-typing/tests/manual/21/1.md

@@ -0,0 +1,18 @@
+## New undo step on applying attribute ([#21](https://github.com/ckeditor/ckeditor5-typing/issues/21))
+
+*Every attribute change should create a new undo step.*
+
+**Check**:
+
+1. Type few letters.
+1. Press styling button (italic, bold, etc).
+1. Type few more letters.
+1. Press undo button.
+
+**Expected**:
+Only the letters typed in step 3 should be undone.
+
+5. Press undo button.
+
+**Expected**:
+Letters typed in step 1 should be undone.