8
0
Просмотр исходного кода

Tests: corrected manual test for issue #49.

Szymon Cofalik 9 лет назад
Родитель
Сommit
f7736020c2

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

@@ -5,3 +5,5 @@
 <div id="editor">
 	<p>This is an editor instance.</p>
 </div>
+<br /><br />
+<button id="nbsp">Insert &amp;nbsp;</button>

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

@@ -20,6 +20,13 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 
 	const editable = editor.ui.editableElement;
 
+	document.querySelector( '#nbsp' ).addEventListener( 'click', () => {
+		editor.document.enqueueChanges( () => {
+			editor.document.selection.collapseToStart();
+			editor.document.batch().weakInsert( editor.document.selection.getFirstPosition(), '\u00A0' );
+		} );
+	} );
+
 	editor.document.on( 'changesDone', () => {
 		console.clear();
 

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

@@ -15,11 +15,4 @@ Open console and start using <kbd>space</kbd>. After each change, console is ref
 Use `editor.setData()` to test whether whitespaces in input HTML are correctly removed and `&nbsp;` are correctly
 saved in model and view. `&nbsp;` inserted through `editor.setData()` should be kept, not changed to normal spaces.
 
-Test at least this scenario:
-* fire `editor.setData( '<p>&nbsp;x</p>' )`,
-* place caret at the beginning, before space,
-* write `x` -> `&nbsp;` should be preserved in model, view and DOM,
-* place caret at the beginning,
-* press <kbd>space</kbd> -> `&nbsp;` should appear in DOM, but space in model and view,
-* place caret at the beginning,
-* write `x` -> `&nbsp;` should get converted to a space in DOM.
+Use the button to test whether `&nbsp;`s are correctly preserved in model, view and DOM.