浏览代码

Tests: Added manual tests for MathType and Wproofreader.

Kamil Piechaczek 6 年之前
父节点
当前提交
6b7dabc9e9

+ 55 - 0
tests/manual/mathtype.html

@@ -0,0 +1,55 @@
+<head>
+	<!-- Required to fetch runtime data from https://www.wiris.net. -->
+	<meta http-equiv="Content-Security-Policy"
+		content="connect-src 'self' https://cksource.com http://*.cke-cs.com https://www.wiris.net;">
+</head>
+
+<div id="editor">
+	<h2>Hello world!</h2>
+
+	<figure class="table">
+		<table>
+			<tbody>
+				<tr>
+					<td>
+						<h2>Header 2</h2>
+
+						<p>Sample text with <span class="mention" data-mention="@Lily">@Lily</span> mentioned.</p>
+					</td>
+					<td>
+						<span style="color:hsl(0,75%,60%);"><i>Colors</i></span>
+						<span style="background-color:hsl(270,75%,60%);color:hsl(0,0%,100%);"><strong>are</strong></span>
+						plain
+						<span class="text-big" style="color:hsl(210,75%,60%);">awesome</span>
+						<span class="text-huge"><mark class="marker-yellow">!</mark></span>
+					</td>
+				</tr>
+				<tr>
+					<td>
+						<figure class="image">
+							<img src="sample.jpg" alt="CKEditor logo" />
+							<figcaption>An <u>image</u></figcaption>
+						</figure>
+					</td>
+					<td>
+						<ol>
+							<li>First</li>
+							<li>Second</li>
+							<li>Third</li>
+						</ol>
+
+						<p>Closing paragraph.</p>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</figure>
+
+	<blockquote>
+		<p>This is a quote block.</p>
+	</blockquote>
+
+	<p style="text-align:center;">Centered paragraph.</p>
+
+	<p>Sample text</p>
+</div>

+ 76 - 0
tests/manual/mathtype.js

@@ -0,0 +1,76 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* globals console:false, document, window */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
+import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
+import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
+import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
+import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';
+import Subscript from '@ckeditor/ckeditor5-basic-styles/src/subscript';
+import Superscript from '@ckeditor/ckeditor5-basic-styles/src/superscript';
+import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
+import Font from '@ckeditor/ckeditor5-font/src/font';
+import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
+import Indent from '@ckeditor/ckeditor5-indent/src/indent';
+import Mention from '@ckeditor/ckeditor5-mention/src/mention';
+import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
+import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat';
+import MathType from '@wiris/mathtype-ckeditor5';
+
+import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		cloudServices: CS_CONFIG,
+		plugins: [
+			ArticlePluginSet,
+			Alignment,
+			Underline,
+			Strikethrough,
+			Code,
+			Subscript,
+			Superscript,
+			EasyImage,
+			Font,
+			Highlight,
+			Indent,
+			Mention,
+			PasteFromOffice,
+			RemoveFormat,
+			MathType
+		],
+		toolbar: [
+			'MathType', 'ChemType', '|', 'heading', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor',
+			'highlight', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', 'code', 'subscript',
+			'superscript', 'removeFormat', '|', 'bulletedList', 'numberedList', 'indent', 'outdent', '|', 'link',
+			'blockQuote', 'imageUpload', 'mediaEmbed', 'insertTable', '|', 'undo', 'redo'
+		],
+		image: {
+			toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
+		},
+		mediaEmbed: {
+			previewsInData: true,
+			toolbar: [ 'blockQuote' ]
+		},
+		mention: {
+			feeds: [ {
+				marker: '@',
+				feed: [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ]
+			} ]
+		},
+		table: {
+			contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ],
+			tableToolbar: [ 'bold', 'italic' ]
+		}
+	} )
+	.then( newEditor => {
+		window.editor = newEditor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 0 - 0
tests/manual/mathtype.md


二进制
tests/manual/sample.jpg


+ 69 - 0
tests/manual/wproofreader.html

@@ -0,0 +1,69 @@
+<head>
+	<!--
+		Required to fetch runtime data from https://svc.webspellchecker.net.
+		Also both unsafe inline and eval are required for it to work (https://github.com/WebSpellChecker/wproofreader/issues/19).
+	-->
+	<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' https://cksource.com https://svc.webspellchecker.net;">
+</head>
+
+<script
+	type="text/javascript"
+	src="https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js"
+	data-wsc-serviceid="1:Eebp63-lWHbt2-ASpHy4-AYUpy2-fo3mk4-sKrza1-NsuXy4-I1XZC2-0u2F54-aqYWd1-l3Qf14-umd"
+	data-wsc-autosearch="true"
+	data-wsc-enablegrammar="true"
+></script>
+
+<div id="editor">
+	<h2>Hello world witth an obvious typo</h2>
+
+	<figure class="table">
+		<table>
+			<tbody>
+				<tr>
+					<td>
+						<h2>Header 2</h2>
+
+						<p>
+							<span class="mention" data-mention="@Ted">@Ted</span>
+							very rarely makes a typo. However he occasionally forgets to add a comma after “however”.
+						</p>
+					</td>
+					<td>
+						<span style="color:hsl(0,75%,60%);"><i>Colors</i></span>
+						<span
+							style="background-color:hsl(270,75%,60%);color:hsl(0,0%,100%);"><strong>are</strong></span>
+						plain
+						<span class="text-big" style="color:hsl(210,75%,60%);">awesome</span>
+						<span class="text-huge"><mark class="marker-yellow">!</mark></span>
+					</td>
+				</tr>
+				<tr>
+					<td>
+						<figure class="image">
+							<img src="sample.jpg" alt="CKEditor logo" />
+							<figcaption>An <u>image</u></figcaption>
+						</figure>
+					</td>
+					<td>
+						<ol>
+							<li>First</li>
+							<li>Second</li>
+							<li>Third</li>
+						</ol>
+
+						<p>Closing paragraph.</p>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+	</figure>
+
+	<blockquote>
+		<p>This is a quote block.</p>
+	</blockquote>
+
+	<p style="text-align:center;">Centered paragraph.</p>
+
+	<p>Sample text</p>
+</div>

+ 75 - 0
tests/manual/wproofreader.js

@@ -0,0 +1,75 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* globals console:false, document, window */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
+import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
+import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
+import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
+import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';
+import Subscript from '@ckeditor/ckeditor5-basic-styles/src/subscript';
+import Superscript from '@ckeditor/ckeditor5-basic-styles/src/superscript';
+import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
+import Font from '@ckeditor/ckeditor5-font/src/font';
+import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
+import Indent from '@ckeditor/ckeditor5-indent/src/indent';
+import Mention from '@ckeditor/ckeditor5-mention/src/mention';
+import PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
+import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat';
+
+import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		cloudServices: CS_CONFIG,
+		plugins: [
+			ArticlePluginSet,
+			Alignment,
+			Underline,
+			Strikethrough,
+			Code,
+			Subscript,
+			Superscript,
+			EasyImage,
+			Font,
+			Highlight,
+			Indent,
+			Mention,
+			PasteFromOffice,
+			RemoveFormat,
+		],
+		toolbar: [
+			'heading', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor', 'highlight', 'alignment', '|',
+			'bold', 'italic', 'underline', 'strikethrough', 'code', 'subscript', 'superscript', 'removeFormat', '|',
+			'link', 'blockQuote', 'imageUpload', 'mediaEmbed', 'insertTable', '|',
+			'bulletedList', 'numberedList', 'indent', 'outdent', '|', 'undo', 'redo',
+			'|'
+		],
+		image: {
+			toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
+		},
+		mediaEmbed: {
+			previewsInData: true,
+			toolbar: [ 'blockQuote' ]
+		},
+		mention: {
+			feeds: [ {
+				marker: '@',
+				feed: [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ]
+			} ]
+		},
+		table: {
+			contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ],
+			tableToolbar: [ 'bold', 'italic' ]
+		}
+	} )
+	.then( newEditor => {
+		window.editor = newEditor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 24 - 0
tests/manual/wproofreader.md

@@ -0,0 +1,24 @@
+# Wproofreader
+
+Note: the plugin starts checking only **after focusing** the editor.
+
+## Inline typo correction
+
+1. Focus the editor.
+1. Wait until typos are indicated.
+1. Hover mouse cursor over "witth".
+1. Pick "with" from appearing context menu.
+
+## Inline grammar correction
+
+1. Focus the editor.
+1. Wait until typos are indicated.
+1. Hover mouse cursor over (the first) "However".
+1. Pick "However," from appearing context menu.
+
+## Dialog checking
+
+1. Focus the editor.
+1. Hover a spell check icon in the bottom-right corner of the editable.
+1. Click "Proofread in dialog" option.
+1. Use it to fix a typo.