Bladeren bron

Tests: Replaced link by underline in `bindTwoStepCaretToAttribute` manual test.

Oskar Wróbel 7 jaren geleden
bovenliggende
commit
f2a21f8bf9

+ 1 - 0
packages/ckeditor5-engine/package.json

@@ -16,6 +16,7 @@
     "@ckeditor/ckeditor5-enter": "^1.0.0-alpha.2",
     "@ckeditor/ckeditor5-essentials": "^1.0.0-alpha.2",
     "@ckeditor/ckeditor5-heading": "^1.0.0-alpha.2",
+    "@ckeditor/ckeditor5-link": "^1.0.0-alpha.2",
     "@ckeditor/ckeditor5-list": "^1.0.0-alpha.2",
     "@ckeditor/ckeditor5-paragraph": "^1.0.0-alpha.2",
     "@ckeditor/ckeditor5-typing": "^1.0.0-alpha.2",

+ 1 - 33
packages/ckeditor5-engine/tests/manual/twostepscarret.html

@@ -1,36 +1,4 @@
 <div id="editor">
-	<p>Foo <a href="abc">bar</a> biz</p>
+	<p>Foo <u>bar</u> biz</p>
 	<p>Foo <b>bar</b> biz</p>
 </div>
-
-<div class="wrapper">
-	<div class="status-box"></div>
-	<p>
-		- When selection is inside the link then box is <span style="color: lightgreen">green</span>
-		when is outside the link then is <span style="color: cornflowerblue">blue</span>.
-	</p>
-</div>
-
-<style type="text/css">
-	.wrapper {
-		vertical-align: middle;
-		padding: 20px 0;
-	}
-
-	.wrapper p {
-		display: inline-block;
-		margin: 0;
-	}
-
-	.status-box {
-		width: 100px;
-		height: 30px;
-		background: cornflowerblue;
-		display: inline-block;
-		vertical-align: middle;
-	}
-
-	.active {
-		background: lightgreen;
-	}
-</style>

+ 4 - 10
packages/ckeditor5-engine/tests/manual/twostepscarret.js

@@ -8,24 +8,18 @@
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import LinkEngine from '@ckeditor/ckeditor5-link/src/linkengine';
+import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 
 import bindTwoStepCaretToAttribute from '@ckeditor/ckeditor5-engine/src/utils/bindtwostepcarettoattribute';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ Essentials, Paragraph, LinkEngine, Bold ],
-		toolbar: [ 'undo', 'redo', 'bold' ]
+		plugins: [ Essentials, Paragraph, Underline, Bold ],
+		toolbar: [ 'undo', 'redo', '|', 'bold', 'underline' ]
 	} )
 	.then( editor => {
-		const selection = editor.model.document.selection;
-
-		bindTwoStepCaretToAttribute( editor, editor, 'linkHref' );
-
-		selection.on( 'change', () => {
-			document.querySelector( '.status-box' ).classList.toggle( 'active', selection.hasAttribute( 'linkHref' ) );
-		} );
+		bindTwoStepCaretToAttribute( editor, editor, 'underline' );
 	} )
 	.catch( err => {
 		console.error( err.stack );

+ 25 - 20
packages/ckeditor5-engine/tests/manual/twostepscarret.md

@@ -1,41 +1,46 @@
 ## Two-steps caret movment [#1286](https://github.com/ckeditor/ckeditor5-engine/issues/1289)
 
 ### Moving right
-1. Put selection one character before the link
+1. Put selection one character before the underline
 2. Move selection by one character to the right using right arrow
-	- selection should be outside the link
+	- underline button should be not selected
 3. Press right arrow once again
-	- selection should be at the same position but inside the link
-4. Using right arrow move selection at the end of the link
-	- selection should be still inside the link
+	- selection should be at the same position
+	- underline button should be selected
+4. Using right arrow move selection at the end of the underline
+	- underline button should be selected
 5. Press right arrow once again
-	- selection should be at the same position but outside the link
+	- selection should be at the same position
+	- underline button should be not selected
 
 ### Moving left
-1. Put selection one character after the link
+1. Put selection one character after the underline
 2. Move selection by one character to the left using left arrow
-	- selection should be outside the link (ignore the blink).
+	- underline button should be not selected
 3. Press left arrow once again
-	- selection should be at the same position but inside the link
-4. Using left arrow move selection at the beginning of the link
-	- selection should be still inside the link (ignore the blink).
+	- selection should be at the same position
+	- underline button should be selected
+4. Using left arrow move selection at the beginning of the underline
+	- underline button should be selected
 5. Press left arrow once again
-	- selection should be at the same position but outside the link
+	- selection should be at the same position
+	- underline button should be not selected
 
 ### Mouse
-1. Put selection at the beginning of the link
-	- selection should be outside the link
-2. Put selection at the end of the link
-	- selection should be inside the link
+1. Put selection at the beginning of the underline
+	- underline button should be not selected
+2. Put selection at the end of the underline
+	- underline button should be  selected
 
 ### Attributes set explicit
-1. Put selection one character before the end of the link
+1. Put selection one character before the end of the underline
 2. Move selection by one character to the right using right arrow
-	- selection should be inside the link
+	- underline button should be selected
 3. Turn on bold attribute (`Ctrl + B`)
 3. Press right arrow once again
-	- selection should be at the same position but outside the link
-	- bold should stay enabled
+	- selection should be at the same position
+	- underline button should be not selected
+	- bold button should stay selected
 
 ### Not bounded attribute
 Just make sure that two-steps caret movement is disabled for bold text from the second paragraph.