8
0
Просмотр исходного кода

Removed the dataProcessor argument, as it was never used in practice.

Piotrek Koszuliński 5 лет назад
Родитель
Сommit
74b0b28927

+ 5 - 8
packages/ckeditor5-engine/src/controller/datacontroller.js

@@ -46,12 +46,10 @@ export default class DataController {
 	/**
 	 * Creates a data controller instance.
 	 *
-	 * @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor Styles processor.
 	 * @param {module:engine/model/model~Model} model Data model.
-	 * @param {module:engine/dataprocessor/dataprocessor~DataProcessor} [dataProcessor] Data processor that should be used
-	 * by the controller.
+	 * @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor Styles processor.
 	 */
-	constructor( stylesProcessor, model, dataProcessor ) {
+	constructor( model, stylesProcessor ) {
 		/**
 		 * Data model.
 		 *
@@ -61,7 +59,7 @@ export default class DataController {
 		this.model = model;
 
 		/**
-		 * StylesProcessor is responsible for writing and reading a normalized styles object.
+		 * Styles processor used during the conversion.
 		 *
 		 * @readonly
 		 * @member {module:engine/view/stylesmap~StylesProcessor}
@@ -71,10 +69,9 @@ export default class DataController {
 		/**
 		 * Data processor used during the conversion.
 		 *
-		 * @readonly
-		 * @member {module:engine/dataprocessor/dataprocessor~DataProcessor}
+		 * @member {module:engine/dataprocessor/dataprocessor~DataProcessor} #processor
 		 */
-		this.processor = dataProcessor;
+		this.processor;
 
 		/**
 		 * Mapper used for the conversion. It has no permanent bindings, because they are created when getting data and

+ 8 - 5
packages/ckeditor5-engine/tests/controller/datacontroller.js

@@ -41,17 +41,20 @@ describe( 'DataController', () => {
 		viewDocument = new ViewDocument( stylesProcessor );
 		htmlDataProcessor = new HtmlDataProcessor( viewDocument );
 
-		data = new DataController( stylesProcessor, model, htmlDataProcessor );
+		data = new DataController( model, stylesProcessor );
+		data.processor = htmlDataProcessor;
 
 		upcastHelpers = new UpcastHelpers( [ data.upcastDispatcher ] );
 		downcastHelpers = new DowncastHelpers( [ data.downcastDispatcher ] );
 	} );
 
 	describe( 'constructor()', () => {
-		it( 'works without data processor', () => {
-			const data = new DataController( new StylesProcessor(), model );
+		it( 'sets the model and styles processor properties', () => {
+			const stylesProcessor = new StylesProcessor();
+			const data = new DataController( model, stylesProcessor );
 
-			expect( data.processor ).to.be.undefined;
+			expect( data.model ).to.equal( model );
+			expect( data.stylesProcessor ).to.equal( stylesProcessor );
 		} );
 	} );
 
@@ -577,7 +580,7 @@ describe( 'DataController', () => {
 	describe( 'addStyleProcessorRules()', () => {
 		it( 'should execute callback with an instance of StyleProcessor as the first argument', () => {
 			const stylesProcessor = new StylesProcessor();
-			const data = new DataController( stylesProcessor, model, htmlDataProcessor );
+			const data = new DataController( model, stylesProcessor );
 
 			const spy = sinon.spy();