Przeglądaj źródła

Add execute() test for partial attribute selected.

Maciej Gołaszewski 6 lat temu
rodzic
commit
1a5a832f0d

+ 10 - 0
packages/ckeditor5-restricted-editing/tests/restricteddocumentcommand.js

@@ -141,6 +141,16 @@ describe( 'RestrictedDocumentCommand', () => {
 			expect( getData( model ) ).to.equal( '<p>[<$text nonRestricted="true">foobar</$text>]baz</p>' );
 		} );
 
+		it( 'should remove attribute only from selected part of non-restricted text', () => {
+			setData( model, '<p><$text nonRestricted="true">foo[bar]baz</$text></p>' );
+
+			command.execute();
+
+			expect( getData( model ) ).to.equal(
+				'<p><$text nonRestricted="true">foo</$text>[bar]<$text nonRestricted="true">baz</$text></p>'
+			);
+		} );
+
 		it( 'should remove attribute from selected nodes if the command value was true', () => {
 			setData( model, '<p>abc[<$text nonRestricted="true">foo]bar</$text>xyz</p>' );