8
0
Эх сурвалжийг харах

Add test for checking removing attribute when other attributes are present.

Maciej Gołaszewski 6 жил өмнө
parent
commit
2b2b1e2978

+ 16 - 0
packages/ckeditor5-restricted-editing/tests/restrictededitingexceptioncommand.js

@@ -172,6 +172,22 @@ describe( 'RestrictedEditingExceptionCommand', () => {
 				expect( getData( model ) ).to.equal( '<p>abc<$text restrictedEditingException="true">[]foobar</$text>baz</p>' );
 			} );
 
+			it( 'should remove attribute from text nodes when other attributes are present', () => {
+				setData( model,
+					'<p>' +
+					'<$text bold="true">abc</$text>' +
+					'<$text bold="true" restrictedEditingException="true">foo[]</$text>' +
+					'<$text restrictedEditingException="true">bar</$text>' +
+					'baz' +
+					'</p>'
+				);
+
+				command.execute();
+
+				expect( model.document.selection.hasAttribute( 'restrictedEditingException' ) ).to.be.false;
+				expect( getData( model ) ).to.equal( '<p><$text bold="true">abcfoo[]</$text>barbaz</p>' );
+			} );
+
 			it( 'should remove selection attribute if selection does not have it (selection at the beginning)', () => {
 				setData( model, '<p>abc<$text restrictedEditingException="true">[]foobar</$text>baz</p>' );