Răsfoiți Sursa

Remove unnecessary autoamtic test which is cover now by filter test.

Mateusz Samsel 6 ani în urmă
părinte
comite
a56e8206f1

+ 3 - 9
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/index.js

@@ -4,26 +4,20 @@
  */
  */
 
 
 import simpleText from './simple-text/input.html';
 import simpleText from './simple-text/input.html';
-import simpleTextFromFirefox from './simple-text-from-firefox/input.html';
 
 
 import simpleTextNormalized from './simple-text/normalized.html';
 import simpleTextNormalized from './simple-text/normalized.html';
-import simpleTextFromFirefoxNormalized from './simple-text-from-firefox/normalized.html';
 
 
 import simpleTextModel from './simple-text/model.html';
 import simpleTextModel from './simple-text/model.html';
-import simpleTextFromFirefoxModel from './simple-text-from-firefox/model.html';
 
 
 export const fixtures = {
 export const fixtures = {
 	input: {
 	input: {
-		simpleText,
-		simpleTextFromFirefox
+		simpleText
 	},
 	},
 	normalized: {
 	normalized: {
-		simpleText: simpleTextNormalized,
-		simpleTextFromFirefox: simpleTextFromFirefoxNormalized
+		simpleText: simpleTextNormalized
 	},
 	},
 	model: {
 	model: {
-		simpleText: simpleTextModel,
-		simpleTextFromFirefox: simpleTextFromFirefoxModel
+		simpleText: simpleTextModel
 	}
 	}
 };
 };
 
 

+ 0 - 1
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/simple-text-from-firefox/input.html

@@ -1 +0,0 @@
-<meta charset="utf-8"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" id="docs-internal-guid-e4b9bad6-7fff-c086-3135-e187abe577a0"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Hello world</span></p>

+ 0 - 1
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/simple-text-from-firefox/model.html

@@ -1 +0,0 @@
-<paragraph>Hello world</paragraph>

+ 0 - 1
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/simple-text-from-firefox/normalized.html

@@ -1 +0,0 @@
-<p dir="ltr" id="docs-internal-guid-e4b9bad6-7fff-c086-3135-e187abe577a0" style="line-height:1.38;margin-bottom:0pt;margin-top:0pt"><span style="background-color:transparent;color:#000000;font-family:Arial;font-size:11pt;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Hello world</span></p>

+ 0 - 1
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/simple-text-from-firefox/simple-text-from-firefox.html

@@ -1 +0,0 @@
-<html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type"><style type="text/css">ol{margin:0;padding:0}table td,table th{padding:0}.c1{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:11pt;font-family:"Arial";font-style:normal}.c0{padding-top:0pt;padding-bottom:0pt;line-height:1.15;orphans:2;widows:2;text-align:left}.c2{background-color:#ffffff;max-width:468pt;padding:72pt 72pt 72pt 72pt}.title{padding-top:0pt;color:#000000;font-size:26pt;padding-bottom:3pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}.subtitle{padding-top:0pt;color:#666666;font-size:15pt;padding-bottom:16pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}li{color:#000000;font-size:11pt;font-family:"Arial"}p{margin:0;color:#000000;font-size:11pt;font-family:"Arial"}h1{padding-top:20pt;color:#000000;font-size:20pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h2{padding-top:18pt;color:#000000;font-size:16pt;padding-bottom:6pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h3{padding-top:16pt;color:#434343;font-size:14pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h4{padding-top:14pt;color:#666666;font-size:12pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h5{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}h6{padding-top:12pt;color:#666666;font-size:11pt;padding-bottom:4pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;font-style:italic;orphans:2;widows:2;text-align:left}</style></head><body class="c2"><p class="c0"><span class="c1">Hello world</span></p></body></html>

+ 1 - 1
packages/ckeditor5-paste-from-office/tests/_data/paste-from-google-docs/simple-text/input.html

@@ -1 +1 @@
-<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-45309eee-7fff-33a3-6dbd-a7e55da535b5"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Hello world</span></p></b><br class="Apple-interchange-newline">
+<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-45309eee-7fff-33a3-6dbd-1234567890ab"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Hello world</span></p></b><br class="Apple-interchange-newline">

+ 45 - 0
packages/ckeditor5-paste-from-office/tests/filters/common.js

@@ -0,0 +1,45 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
+import { removeBoldTagWrapper } from '../../src/filters/common';
+
+describe( 'Paste from Office - filters', () => {
+	const htmlDataProcessor = new HtmlDataProcessor();
+	describe( 'common', () => {
+		describe( 'removeBoldTagWrapper', () => {
+			it( 'should remove bold wrapper added by google docs', () => {
+				const inputData = '<b style="font-weight:normal;" id="docs-internal-guid-45309eee-7fff-33a3-6dbd-1234567890ab">' +
+					'<p>Hello world</p>' +
+					'</b>';
+				const documentFragment = htmlDataProcessor.toView( inputData );
+
+				removeBoldTagWrapper( documentFragment );
+
+				expect( htmlDataProcessor.toData( documentFragment ) ).to.equal( '<p>Hello world</p>' );
+			} );
+
+			it( 'should not remove non-bold tag with google id', () => {
+				const inputData = '<p id="docs-internal-guid-e4b9bad6-7fff-c086-3135-1234567890ab">Hello world</p>';
+				const documentFragment = htmlDataProcessor.toView( inputData );
+
+				removeBoldTagWrapper( documentFragment );
+
+				expect( htmlDataProcessor.toData( documentFragment ) ).to.equal(
+					'<p id="docs-internal-guid-e4b9bad6-7fff-c086-3135-1234567890ab">Hello world</p>' );
+			} );
+
+			it( 'should not remove bold tag without google id', () => {
+				const inputData = '<b>Hello world</b>';
+				const documentFragment = htmlDataProcessor.toView( inputData );
+
+				removeBoldTagWrapper( documentFragment );
+
+				expect( htmlDataProcessor.toData( documentFragment ) ).to.equal(
+					'<b>Hello world</b>' );
+			} );
+		} );
+	} );
+} );