Sfoglia il codice sorgente

Tests: Added missing beforeEach(). Without it the doc's schema was only extended in the first test.

Piotrek Koszuliński 8 anni fa
parent
commit
c49dc607d9
1 ha cambiato i file con 12 aggiunte e 10 eliminazioni
  1. 12 10
      packages/ckeditor5-engine/tests/controller/insertcontent.js

+ 12 - 10
packages/ckeditor5-engine/tests/controller/insertcontent.js

@@ -544,19 +544,21 @@ describe( 'DataController', () => {
 	} );
 
 	describe( 'integration with limit elements', () => {
-		doc = new Document();
-		doc.createRoot();
-		dataController = new DataController( doc );
+		beforeEach( () => {
+			doc = new Document();
+			doc.createRoot();
+			dataController = new DataController( doc );
 
-		const schema = doc.schema;
+			const schema = doc.schema;
 
-		schema.registerItem( 'limit' );
-		schema.allow( { name: 'limit', inside: '$root' } );
-		schema.allow( { name: '$text', inside: 'limit' } );
-		schema.limits.add( 'limit' );
+			schema.registerItem( 'limit' );
+			schema.allow( { name: 'limit', inside: '$root' } );
+			schema.allow( { name: '$text', inside: 'limit' } );
+			schema.limits.add( 'limit' );
 
-		schema.registerItem( 'disallowedElement' );
-		schema.allow( { name: 'disallowedElement', inside: '$clipboardHolder' } );
+			schema.registerItem( 'disallowedElement' );
+			schema.allow( { name: 'disallowedElement', inside: '$clipboardHolder' } );
+		} );
 
 		it( 'should insert limit element', () => {
 			insertHelper( '<limit></limit>' );