Przeglądaj źródła

Add manual tests for the AutoLink feature.

Maciej Gołaszewski 5 lat temu
rodzic
commit
39ced1d88c

+ 3 - 0
packages/ckeditor5-link/tests/manual/autolink.html

@@ -0,0 +1,3 @@
+<div id="editor">
+	<p>This is <a href="http://ckeditor.com">CKEditor5</a> from <a href="http://cksource.com">CKSource</a>.</p>
+</div>

+ 29 - 0
packages/ckeditor5-link/tests/manual/autolink.js

@@ -0,0 +1,29 @@
+/**
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* globals console:false, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+
+import Enter from '@ckeditor/ckeditor5-enter/src/enter';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
+import ShiftEnter from '@ckeditor/ckeditor5-enter/src/shiftenter';
+import Typing from '@ckeditor/ckeditor5-typing/src/typing';
+import Undo from '@ckeditor/ckeditor5-undo/src/undo';
+
+import Link from '../../src/link';
+import AutoLink from '../../src/autolink';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Link, AutoLink, Typing, Paragraph, Undo, Enter, ShiftEnter ],
+		toolbar: [ 'link', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 24 - 0
packages/ckeditor5-link/tests/manual/autolink.md

@@ -0,0 +1,24 @@
+## AutoLink feature
+
+### After a space
+
+1. Type a URL:
+    - Staring with `http://`.
+    - staring with `https://`.
+    - staring without a protocol (www.cksource.com).
+2. Type space after a URL.
+3. Check if text typed before space get converted to link.
+
+### After a soft break/new paragraph
+
+1. Type a URL as in base scenario.
+2. Press <kbd>Enter</kbd> or <kbd>Shift</kbd>+<kbd>Enter</kbd> after a link.
+3. Check if text typed pressed key get converted to link.
+
+### Undo integration
+
+1. Execute auto link either with "space" or with "enter" scenarios.
+2. Execute undo.
+3. Check if *only* created link was removed:
+    - For "space" - the space after the text link should be preserved.
+    - For "enter" - the new block or `<softBreak>` should be preserved.