Преглед изворни кода

Tests: added manual test checking whether   characters are removed/inserted correctly.

Szymon Cofalik пре 9 година
родитељ
комит
314e3928a4

+ 7 - 0
packages/ckeditor5-typing/tests/tickets/49/1.html

@@ -0,0 +1,7 @@
+<head>
+	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/modules/amd/theme/ckeditor.css">
+</head>
+
+<div id="editor">
+	<p>This is an editor instance.</p>
+</div>

+ 38 - 0
packages/ckeditor5-typing/tests/tickets/49/1.js

@@ -0,0 +1,38 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console:false, document, window */
+
+import ClassicEditor from '/ckeditor5/editor-classic/classic.js';
+import { getData as getModelData } from '/ckeditor5/engine/dev-utils/model.js';
+import { getData as getViewData } from '/ckeditor5/engine/dev-utils/view.js';
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	features: [ 'enter', 'typing', 'paragraph' ],
+	toolbar: []
+} )
+.then( editor => {
+	window.editor = editor;
+
+	editor.document.schema.allow( { name: '$text', inside: '$root' } );
+
+	const editable = editor.ui.editableElement;
+
+	editor.document.on( 'change', () => {
+		console.clear();
+
+		const modelData = getModelData( editor.document, { withoutSelection: true } );
+		console.log( 'model:', modelData.replace( /\u00A0/g, '_' ) );
+
+		const viewData = getViewData( editor.editing.view, { withoutSelection: true } );
+		console.log( 'view:', viewData.replace( /\u00A0/g, '_' ) );
+
+		console.log( 'dom:', editable.innerHTML );
+		console.log( 'editor.getData', editor.getData() );
+	} );
+} )
+.catch( err => {
+	console.error( err.stack );
+} );

+ 12 - 0
packages/ckeditor5-typing/tests/tickets/49/1.md

@@ -0,0 +1,12 @@
+@bender-ui: collapsed
+@bender-tags: ticket, 49, 0.3.0, iteration3
+
+### Issue [#49](https://github.com/ckeditor/ckeditor5-typing/issues/49) manual test
+
+There should be no `&nbsp;` (`\u00A0`) characters in model and view, but they should be rendered in DOM. Multiple
+consecutive spaces should be allowed, as well as spaces at the beginning or end of element.
+
+Open console and start using <kbd>space</kbd>. After each change, console is refreshed with output:
+* All `&nbsp;` from model and view are being changed to `_`.
+* There should be no `_` in view and model output.
+* There should be `&nbsp;` in DOM and `getData` output, where needed.