Explorar el Código

Add test for removing a slot element.

Maciej Gołaszewski hace 5 años
padre
commit
28bd1cf3fb
Se han modificado 1 ficheros con 22 adiciones y 1 borrados
  1. 22 1
      packages/ckeditor5-engine/tests/conversion/downcasthelpers.js

+ 22 - 1
packages/ckeditor5-engine/tests/conversion/downcasthelpers.js

@@ -431,7 +431,8 @@ describe( 'DowncastHelpers', () => {
 							'attribute:classForMain:complex',
 							'attribute:classForWrap:complex',
 							'attribute:attributeToElement:complex',
-							'insert:slot'
+							'insert:slot',
+							'remove:slot'
 						]
 					} );
 
@@ -527,6 +528,26 @@ describe( 'DowncastHelpers', () => {
 					);
 				} );
 
+				it( 'should convert element on removing slot', () => {
+					setModelData( model,
+						'<complex>' +
+							'<slot><paragraph>foo</paragraph></slot>' +
+							'<slot><paragraph>bar</paragraph></slot>' +
+						'</complex>' );
+
+					model.change( writer => {
+						writer.remove( modelRoot.getChild( 0 ).getChild( 0 ) );
+					} );
+
+					expectResult(
+						'<div class="complex-slots">' +
+							'<div class="slots">' +
+								'<div class="slot"><p>foo</p></div>' +
+							'</div>' +
+						'</div>'
+					);
+				} );
+
 				describe( 'memoization', () => {
 					it( 'should create new element on re-converting element', () => {
 						setModelData( model, '<complex>' +