Sfoglia il codice sorgente

Tests: Added paste manual test.

Marek Lewandowski 5 anni fa
parent
commit
5bddcb5687

+ 8 - 0
tests/manual/performance/paste.html

@@ -0,0 +1,8 @@
+<div id="test-controls">
+	Click a button to paste a relevant markup to the editor:
+	<span id="fixture-buttons"></span>
+</div>
+
+<hr>
+
+<div id="editor"></div>

+ 30 - 0
tests/manual/performance/paste.js

@@ -0,0 +1,30 @@
+/**
+ * @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 window, document, DataTransfer */
+
+import { loadPerformanceData, createPerformanceEditor, renderPerformanceDataButtons } from '../../_utils/utils';
+
+renderPerformanceDataButtons( document.querySelector( '#fixture-buttons' ) );
+
+createPerformanceEditor( document.querySelector( '#editor' ) )
+	.then( loadPerformanceData )
+	.then( fixtures => {
+		const buttons = document.querySelectorAll( '#test-controls button' );
+
+		for ( const button of buttons ) {
+			button.addEventListener( 'click', function() {
+				const fixtureHtml = fixtures[ this.getAttribute( 'data-file-name' ) ];
+
+				const data = new DataTransfer();
+				data.setData( 'text/html', fixtureHtml );
+
+				window.editor.editing.view.document.fire( 'clipboardInput', {
+					dataTransfer: data
+				} );
+			} );
+			button.disabled = false;
+		}
+	} );

+ 5 - 0
tests/manual/performance/paste.md

@@ -0,0 +1,5 @@
+# Performance: pasting data
+
+1. Begin performance recording in devtools.
+1. Click a button for a content that you'd like to paste into the editor.
+1. Stop performance recording.