Selaa lähdekoodia

Changed: fixed commented test for deleteContents.

Szymon Cofalik 9 vuotta sitten
vanhempi
commit
a5b45459e7

+ 1 - 0
packages/ckeditor5-engine/src/model/composer/deletecontents.js

@@ -57,6 +57,7 @@ export default function deleteContents( batch, selection, options = {} ) {
 	}
 
 	selection.collapse( startPos );
+	selection.refreshAttributes();
 
 	endPos.detach();
 }

+ 8 - 8
packages/ckeditor5-engine/tests/model/composer/deletecontents.js

@@ -105,14 +105,14 @@ describe( 'Delete utils', () => {
 				expect( document.selection.getAttribute( 'bold' ) ).to.undefined;
 			} );
 
-			//it( 'clears selection attrs when emptied content', () => {
-			//	setData( document, '<p>x</p><p>[<$text bold="true">foo</$text>]</p><p>y</p>' );
-			//
-			//	deleteContents( document.batch(), document.selection );
-			//
-			//	expect( getData( document ) ).to.equal( '<p>x</p><p>[]</p><p>y</p>' );
-			//	expect( document.selection.getAttribute( 'bold' ) ).to.undefined;
-			//} );
+			it( 'clears selection attrs when emptied content', () => {
+				setData( document, '<p>x</p><p>[<$text bold="true">foo</$text>]</p><p>y</p>' );
+
+				deleteContents( document.batch(), document.selection );
+
+				expect( getData( document ) ).to.equal( '<p>x</p><p>[]</p><p>y</p>' );
+				expect( document.selection.getAttribute( 'bold' ) ).to.undefined;
+			} );
 
 			it( 'leaves selection attributes when text contains them', () => {
 				setData( document, '<p>x<$text bold="true">a[foo]b</$text>y</p>' );