Selaa lähdekoodia

Removed SchemaContext from SchemaContext#concat params.

Oskar Wróbel 7 vuotta sitten
vanhempi
commit
53b3200977

+ 3 - 3
packages/ckeditor5-engine/src/model/schema.js

@@ -1166,12 +1166,12 @@ export class SchemaContext {
 	/**
 	 * Returns new SchemaContext instance with additional items created from provided definition.
 	 *
-	 * @param {String|module:engine/model/node~Node|module:engine/model/schema~SchemaContext|
-	 * Array<String|module:engine/model/node~Node>} definition Definition of item(s) that will be added to current context.
+	 * @param {String|module:engine/model/node~Node|Array<String|module:engine/model/node~Node>} definition
+	 * Definition of item(s) that will be added to current context.
 	 * @returns {module:engine/model/schema~SchemaContext} New SchemaContext instance.
 	 */
 	concat( definition ) {
-		if ( !( definition instanceof SchemaContext ) && !Array.isArray( definition ) ) {
+		if ( !Array.isArray( definition ) ) {
 			definition = [ definition ];
 		}
 

+ 3 - 14
packages/ckeditor5-engine/tests/model/schema.js

@@ -2779,7 +2779,7 @@ describe( 'SchemaContext', () => {
 			expect( Array.from( ctx.getNames() ) ).to.deep.equal( [ 'a', 'b', 'c' ] );
 		} );
 
-		it( 'creates new SchemaContext instance with new item - #node', () => {
+		it( 'creates new SchemaContext instance with new item - #element', () => {
 			const ctx = new SchemaContext( [ 'a', 'b', 'c' ] );
 			const parent = new Element( 'parent', null, new Element( 'd' ) );
 
@@ -2791,22 +2791,11 @@ describe( 'SchemaContext', () => {
 			expect( Array.from( ctx.getNames() ) ).to.deep.equal( [ 'a', 'b', 'c' ] );
 		} );
 
-		it( 'creates new SchemaContext instance with new item - #SchemaContext', () => {
-			const ctx = new SchemaContext( [ 'a', 'b', 'c' ] );
-			const schemaContext = new SchemaContext( [ 'd', 'e' ] );
-
-			const newCtx = ctx.concat( schemaContext );
-
-			expect( newCtx ).to.instanceof( SchemaContext );
-			expect( newCtx ).to.not.equal( ctx );
-			expect( Array.from( newCtx.getNames() ) ).to.deep.equal( [ 'a', 'b', 'c', 'd', 'e' ] );
-			expect( Array.from( ctx.getNames() ) ).to.deep.equal( [ 'a', 'b', 'c' ] );
-		} );
-
 		it( 'creates new SchemaContext instance with new item - #array', () => {
 			const ctx = new SchemaContext( [ 'a', 'b', 'c' ] );
+			const parent = new Element( 'parent', null, new Element( 'f' ) );
 
-			const newCtx = ctx.concat( [ 'd', new Text( 'e' ), new Element( 'f' ) ] );
+			const newCtx = ctx.concat( [ 'd', new Text( 'e' ), parent.getChild( 0 ) ] );
 
 			expect( newCtx ).to.instanceof( SchemaContext );
 			expect( newCtx ).to.not.equal( ctx );