8
0
Просмотр исходного кода

Merge branch 'master' into t/ckeditor5/401

Piotrek Koszuliński 7 лет назад
Родитель
Сommit
e3c966f566

+ 2 - 2
packages/ckeditor5-block-quote/package.json

@@ -32,8 +32,8 @@
     "lint-staged": "^7.0.0"
   },
   "engines": {
-    "node": ">=6.9.0",
-    "npm": ">=3.0.0"
+    "node": ">=8.0.0",
+    "npm": ">=5.7.1"
   },
   "author": "CKSource (http://cksource.com/)",
   "license": "GPL-2.0-or-later",

+ 178 - 2
packages/ckeditor5-block-quote/tests/integration.js

@@ -395,6 +395,54 @@ describe( 'BlockQuote integration', () => {
 				'</blockQuote>'
 			);
 		} );
+
+		it( 'wraps paragraph+image', () => {
+			setModelData( model,
+				'<paragraph>[foo</paragraph><image><caption>foo</caption></image>]'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<blockQuote><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</blockQuote>'
+			);
+		} );
+
+		it( 'unwraps paragraph+image', () => {
+			setModelData( model,
+				'<blockQuote><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</blockQuote>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<paragraph>[foo</paragraph><image><caption>foo</caption></image>]'
+			);
+		} );
+
+		it( 'wraps image+paragraph', () => {
+			setModelData( model,
+				'[<image><caption>foo</caption></image><paragraph>foo]</paragraph>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<blockQuote>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></blockQuote>'
+			);
+		} );
+
+		it( 'unwraps image+paragraph', () => {
+			setModelData( model,
+				'[<image><caption>foo</caption></image><paragraph>foo]</paragraph>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<blockQuote>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></blockQuote>'
+			);
+		} );
 	} );
 
 	// When blockQuote with a paragraph was pasted into a list item, the item contained the paragraph. It was invalid.
@@ -444,7 +492,7 @@ describe( 'BlockQuote integration', () => {
 			);
 		} );
 
-		it( 'wraps table cell paragraph', () => {
+		it( 'wraps paragraph in table cell', () => {
 			setModelData( model, '<table><tableRow><tableCell><paragraph>[]foo</paragraph></tableCell></tableRow></table>' );
 
 			editor.execute( 'blockQuote' );
@@ -454,7 +502,7 @@ describe( 'BlockQuote integration', () => {
 			);
 		} );
 
-		it( 'unwraps table cell paragraph', () => {
+		it( 'unwraps paragraph in table cell', () => {
 			setModelData(
 				model,
 				'<table><tableRow><tableCell><blockQuote><paragraph>[]foo</paragraph></blockQuote></tableCell></tableRow></table>'
@@ -466,5 +514,133 @@ describe( 'BlockQuote integration', () => {
 				'<table><tableRow><tableCell><paragraph>[]foo</paragraph></tableCell></tableRow></table>'
 			);
 		} );
+
+		it( 'wraps image in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>[<image><caption>foo</caption></image>]</tableCell>' +
+				'	</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell><blockQuote>[<image><caption>foo</caption></image>]</blockQuote></tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+		} );
+
+		it( 'unwraps image in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell><blockQuote>[<image><caption>foo</caption></image>]</blockQuote></tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>[<image><caption>foo</caption></image>]</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+		} );
+
+		it( 'wraps paragraph+image in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>' +
+							'<blockQuote><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</blockQuote>' +
+						'</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+		} );
+
+		it( 'unwraps paragraph+image in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>' +
+							'<blockQuote><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</blockQuote>' +
+						'</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell><paragraph>[foo</paragraph><image><caption>foo</caption></image>]</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+		} );
+
+		it( 'wraps image+paragraph in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>' +
+							'<blockQuote>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></blockQuote>' +
+						'</tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+		} );
+
+		it( 'unwraps image+paragraph in table cell', () => {
+			setModelData( model,
+				'<table>' +
+					'<tableRow>' +
+						'<tableCell>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></tableCell>' +
+					'</tableRow>' +
+				'</table>'
+			);
+
+			editor.execute( 'blockQuote' );
+
+			expect( getModelData( model ) ).to.equal(
+				'<table>' +
+				'<tableRow>' +
+				'<tableCell>' +
+				'<blockQuote>[<image><caption>foo</caption></image><paragraph>foo]</paragraph></blockQuote>' +
+				'</tableCell>' +
+				'</tableRow>' +
+				'</table>'
+			);
+		} );
 	} );
 } );