ソースを参照

Merge branch t/ckeditor5-engine/1234

Internal: Update API usage after merge t/1234 on engine.
Piotr Jasiun 7 年 前
コミット
f94c5e02e4

+ 6 - 12
packages/ckeditor5-paragraph/tests/paragraph.js

@@ -168,12 +168,9 @@ describe( 'Paragraph feature', () => {
 			} );
 
 			it( 'should not fail when text is not allowed in paragraph', () => {
-				model.schema.on( 'checkChild', ( evt, args ) => {
-					const def = model.schema.getDefinition( args[ 1 ] );
-
-					if ( args[ 0 ].endsWith( '$root paragraph' ) && def.name == '$text' ) {
-						evt.stop();
-						evt.return = false;
+				model.schema.addChildCheck( ( ctx, childDef ) => {
+					if ( ctx.endsWith( '$root paragraph' ) && childDef.name == '$text' ) {
+						return false;
 					}
 				} );
 
@@ -408,12 +405,9 @@ describe( 'Paragraph feature', () => {
 		} );
 
 		it( 'should not fix root which does not allow paragraph', () => {
-			model.schema.on( 'checkChild', ( evt, args ) => {
-				const def = model.schema.getDefinition( args[ 1 ] );
-
-				if ( args[ 0 ].endsWith( '$root' ) && def.name == 'paragraph' ) {
-					evt.stop();
-					evt.return = false;
+			model.schema.addChildCheck( ( ctx, childDef ) => {
+				if ( ctx.endsWith( '$root' ) && childDef.name == 'paragraph' ) {
+					return false;
 				}
 			} );
 

+ 3 - 6
packages/ckeditor5-paragraph/tests/paragraphcommand.js

@@ -109,12 +109,9 @@ describe( 'ParagraphCommand', () => {
 				allowIn: 'restricted'
 			} );
 
-			model.schema.on( 'checkChild', ( evt, args ) => {
-				const def = model.schema.getDefinition( args[ 1 ] );
-
-				if ( args[ 0 ].endsWith( 'restricted' ) && def.name == 'paragraph' ) {
-					evt.stop();
-					evt.return = false;
+			model.schema.addChildCheck( ( ctx, childDef ) => {
+				if ( ctx.endsWith( 'restricted' ) && childDef.name == 'paragraph' ) {
+					return false;
 				}
 			} );