Browse Source

Renamed view converter builder.

Oskar Wrobel 9 years ago
parent
commit
510c45b872

+ 0 - 3
packages/ckeditor5-engine/src/conversion/buildmodelconverter.js

@@ -64,9 +64,6 @@ import ViewContainerElement from '../view/containerelement.js';
 class ModelConverterBuilder {
 	/**
 	 * Creates `ModelConverterBuilder` with given `dispatchers` registered to it.
-	 *
-	 * @param {Array.<engine.conversion.ModelConversionDispatcher>} dispatchers Dispatchers to which converters will
-	 * be attached.
 	 */
 	constructor() {
 		/**

+ 37 - 30
packages/ckeditor5-engine/src/conversion/view-converter-builder.js

@@ -15,7 +15,7 @@ import isIterable from '../../utils/isiterable.js';
  * HTML content to the editor. Then, converters are used to translate this structure, possibly removing unknown/incorrect
  * nodes, and add it to the model. Also multiple, different elements might be translated into the same thing in the
  * model, i.e. `<b>` and `<strong>` elements might be converted to `bold` attribute (even though `bold` attribute will
- * be then converted only to `<strong>` tag). Instances of this class are created by {@link engine.conversion.BuildViewConverterFor}.
+ * be then converted only to `<strong>` tag). Instances of this class are created by {@link engine.conversion.buildViewConverter}.
  *
  * If you need more complex converters, see {@link engine.conversion.ViewConversionDispatcher},
  * {@link engine.conversion.viewToModel}, {@link engine.conversion.ViewConsumable}.
@@ -24,22 +24,22 @@ import isIterable from '../../utils/isiterable.js';
  *
  * 1. View element to model element:
  *
- *		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+ *		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
  *
  * 2. View element to model attribute:
  *
- *		BuildViewConverterFor( dispatcher ).fromElement( 'b' ).fromElement( 'strong' ).toAttribute( 'bold', 'true' );
+ *		buildViewConverter().for( dispatcher ).fromElement( 'b' ).fromElement( 'strong' ).toAttribute( 'bold', 'true' );
  *
  * 3. View attribute to model attribute:
  *
- *		BuildViewConverterFor( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
- *		BuildViewConverterFor( dispatcher )
+ *		buildViewConverter().for( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
+ *		buildViewConverter().for( dispatcher )
  *			.fromAttribute( 'class' )
  *			.toAttribute( ( viewElement ) => ( { class: viewElement.getAttribute( 'class' ) } ) );
  *
  * 4. View elements and attributes to model attribute:
  *
- *		BuildViewConverterFor( dispatcher )
+ *		buildViewConverter().for( dispatcher )
  *			.fromElement( 'b' ).fromElement( 'strong' ).fromAttribute( 'style', { 'font-weight': 'bold' } )
  *			.toAttribute( 'bold', 'true' );
  *
@@ -48,9 +48,9 @@ import isIterable from '../../utils/isiterable.js';
  *
  *		const matcher = new ViewMatcher();
  *		matcher.add( 'div', { class: 'quote' } );
- *		BuildViewConverterFor( dispatcher ).from( matcher ).toElement( 'quote' );
+ *		buildViewConverter().for( dispatcher ).from( matcher ).toElement( 'quote' );
  *
- *		BuildViewConverterFor( dispatcher ).from( { name: 'span', class: 'bold' } ).toAttribute( 'bold', 'true' );
+ *		buildViewConverter().for( dispatcher ).from( { name: 'span', class: 'bold' } ).toAttribute( 'bold', 'true' );
  *
  * Note, that converters built using `ViewConverterBuilder` automatically check {@link engine.model.Schema schema}
  * if created model structure is valid. If given conversion would be invalid according to schema, it is ignored.
@@ -80,18 +80,15 @@ import isIterable from '../../utils/isiterable.js';
 class ViewConverterBuilder {
 	/**
 	 * Creates `ViewConverterBuilder` with given `dispatchers` registered to it.
-	 *
-	 * @param {Array.<engine.conversion.ViewConversionDispatcher>} dispatchers Dispatchers to which converters will
-	 * be attached.
 	 */
-	constructor( dispatchers ) {
+	constructor() {
 		/**
 		 * Dispatchers to which converters will be attached.
 		 *
 		 * @type {Array.<engine.conversion.ViewConversionDispatcher>}
 		 * @private
 		 */
-		this._dispatchers = dispatchers;
+		this._dispatchers = [];
 
 		/**
 		 * Stores "from" queries.
@@ -103,9 +100,21 @@ class ViewConverterBuilder {
 	}
 
 	/**
+	 * Set one or more dispatchers which the built converter will be attached to.
+	 *
+	 * @chainable
+	 * @param {...engine.conversion.ViewConversionDispatcher} dispatchers One or more dispatchers.
+	 */
+	for( ...dispatchers ) {
+		this._dispatchers = dispatchers;
+
+		return this;
+	}
+
+	/**
 	 * Registers what view element should be converted.
 	 *
-	 *		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+	 *		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 	 *
 	 * @chainable
 	 * @param {String} elementName View element name.
@@ -118,7 +127,7 @@ class ViewConverterBuilder {
 	/**
 	 * Registers what view attribute should be converted.
 	 *
-	 *		BuildViewConverterFor( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
+	 *		buildViewConverter().for( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
 	 *
 	 * @chainable
 	 * @param {String|RegExp} key View attribute key.
@@ -138,9 +147,9 @@ class ViewConverterBuilder {
 	 *
 	 *		const matcher = new ViewMatcher();
 	 *		matcher.add( 'div', { class: 'quote' } );
-	 *		BuildViewConverterFor( dispatcher ).from( matcher ).toElement( 'quote' );
+	 *		buildViewConverter().for( dispatcher ).from( matcher ).toElement( 'quote' );
 	 *
-	 *		BuildViewConverterFor( dispatcher ).from( { name: 'span', class: 'bold' } ).toAttribute( 'bold', 'true' );
+	 *		buildViewConverter().for( dispatcher ).from( { name: 'span', class: 'bold' } ).toAttribute( 'bold', 'true' );
 	 *
 	 * @chainable
 	 * @param {Object|engine.view.Matcher} matcher View matcher or view matcher pattern.
@@ -169,11 +178,11 @@ class ViewConverterBuilder {
 	 *		// conversion will have to be done in separate converter.
 	 *		// Without consuming modifier, the converter would consume both class and name, so a converter for
 	 *		// span element would not be fired.
-	 *		BuildViewConverterFor( dispatcher )
+	 *		buildViewConverter().for( dispatcher )
 	 *			.from( { name: 'span', class: 'bold' } ).consuming( { class: 'bold' } )
 	 *			.toAttribute( 'bold', 'true' } );
 	 *
-	 *		BuildViewConverterFor( dispatcher )
+	 *		buildViewConverter().for( dispatcher )
 	 *			.fromElement( 'img' ).consuming( { name: true, attributes: [ 'src', 'title' ] } )
 	 *			.toElement( ( viewElement ) => new ModelElement( 'image', { src: viewElement.getAttribute( 'src' ),
 	 *																		title: viewElement.getAttribute( 'title' ) } );
@@ -199,10 +208,10 @@ class ViewConverterBuilder {
 	 * Changes default priority for built converter. It modifies the last `from...` query. Can be used after each
 	 * `from...` query in given chain. Useful for overwriting converters. The lower the number, the earlier converter will be fired.
 	 *
-	 *		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+	 *		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 	 *		// Register converter with proper priority, otherwise "p" element would get consumed by first
 	 *		// converter and the second converter would not be fired.
-	 *		BuildViewConverterFor( dispatcher )
+	 *		buildViewConverter().for( dispatcher )
 	 *			.from( { name: 'p', class: 'custom' } ).withPriority( 9 )
 	 *			.toElement( 'customParagraph' );
 	 *
@@ -230,8 +239,8 @@ class ViewConverterBuilder {
 	 * name as a `string` or a function that will return model element instance. If you provide creator function,
 	 * it will be passed converted view element as first and only parameter.
 	 *
-	 *		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
-	 *		BuildViewConverterFor( dispatcher )
+	 *		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+	 *		buildViewConverter().for( dispatcher )
 	 *			.fromElement( 'img' )
 	 *			.toElement( ( viewElement ) => new ModelElement( 'image', { src: viewElement.getAttribute( 'src' ) } );
 	 *
@@ -297,8 +306,8 @@ class ViewConverterBuilder {
 	 * representing attribute key and attribute value or a function that returns an object with `key` and `value` properties.
 	 * If you provide creator function, it will be passed converted view element as first and only parameter.
 	 *
-	 *		BuildViewConverterFor( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
-	 *		BuildViewConverterFor( dispatcher )
+	 *		buildViewConverter().for( dispatcher ).fromAttribute( 'style', { 'font-weight': 'bold' } ).toAttribute( 'bold', 'true' );
+	 *		buildViewConverter().for( dispatcher )
 	 *			.fromAttribute( 'class' )
 	 *			.toAttribute( ( viewElement ) => ( { key: 'class', value: viewElement.getAttribute( 'class' ) } ) );
 	 *
@@ -400,11 +409,9 @@ function setAttributeOn( toChange, attribute, data, conversionApi ) {
  * view-to-model converters and attach them to provided dispatchers. The method returns an instance of
  * {@link engine.conversion.ViewConverterBuilder}.
  *
- * @external engine.conversion.BuildViewConverterFor
+ * @external engine.conversion.buildViewConverter
  * @memberOf engine.conversion
- * @param {...engine.conversion.ViewConversionDispatcher} dispatchers One or more dispatchers to which
- * the built converter will be attached.
  */
-export default function BuildViewConverterFor( ...dispatchers ) {
-	return new ViewConverterBuilder( dispatchers );
+export default function buildViewConverter() {
+	return new ViewConverterBuilder();
 }

+ 1 - 1
packages/ckeditor5-engine/src/datacontroller.js

@@ -88,7 +88,7 @@ export default class DataController {
 		 *
 		 * Or use {@link engine.conversion.ViewConverterBuilder}:
 		 *
-		 *		BuildViewConverterFor( data.viewToModel ).fromElement( 'b' ).toAttribute( 'bold', 'true' );
+		 *		buildViewConverter().for( data.viewToModel ).fromElement( 'b' ).toAttribute( 'bold', 'true' );
 		 *
 		 * @readonly
 		 * @member {engine.conversion.ViewConversionDispatcher} engine.DataController#viewToModel

+ 30 - 30
packages/ckeditor5-engine/tests/conversion/view-converter-builder.js

@@ -5,7 +5,7 @@
 
 /* bender-tags: conversion */
 
-import BuildViewConverterFor from '/ckeditor5/engine/conversion/view-converter-builder.js';
+import buildViewConverter from '/ckeditor5/engine/conversion/buildviewconverter.js';
 
 import ModelSchema from '/ckeditor5/engine/model/schema.js';
 import ModelDocument from '/ckeditor5/engine/model/document.js';
@@ -94,7 +94,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view element to model element', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
 		const result = dispatcher.convert( new ViewContainerElement( 'p', null, new ViewText( 'foo' ) ), objWithContext );
 		modelRoot.appendChildren( result );
@@ -103,7 +103,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view element to model element using creator function', () => {
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromElement( 'img' )
 			.toElement( ( viewElement ) => new ModelElement( 'image', { src: viewElement.getAttribute( 'src' ) } ) );
 
@@ -114,7 +114,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view element to model attribute', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'strong' ).toAttribute( 'bold', true );
+		buildViewConverter().for( dispatcher ).fromElement( 'strong' ).toAttribute( 'bold', true );
 
 		const result = dispatcher.convert( new ViewAttributeElement( 'strong', null, new ViewText( 'foo' ) ), objWithContext );
 		modelRoot.appendChildren( result );
@@ -124,7 +124,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view element to model attributes using creator function', () => {
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromElement( 'a' )
 			.toAttribute( ( viewElement ) => ( { key: 'linkHref', value: viewElement.getAttribute( 'href' ) } ) );
 
@@ -136,9 +136,9 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view attribute to model attribute', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromAttribute( 'class' )
 			.toAttribute( ( viewElement ) => ( { key: 'class', value: viewElement.getAttribute( 'class' ) } ) );
 
@@ -151,9 +151,9 @@ describe( 'View converter builder', () => {
 	it( 'should convert from view attribute and key to model attribute', () => {
 		dispatcher.on( 'documentFragment', convertToModelFragment() );
 
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
-		BuildViewConverterFor( dispatcher ).fromAttribute( 'class', 'important' ).toAttribute( 'important', true );
-		BuildViewConverterFor( dispatcher ).fromAttribute( 'class', 'theme-nice' ).toAttribute( 'theme', 'nice' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromAttribute( 'class', 'important' ).toAttribute( 'important', true );
+		buildViewConverter().for( dispatcher ).fromAttribute( 'class', 'theme-nice' ).toAttribute( 'theme', 'nice' );
 
 		const viewStructure = new ViewDocumentFragment( [
 			new ViewContainerElement( 'p', { class: 'important' }, new ViewText( 'foo' ) ),
@@ -167,9 +167,9 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from multiple view entities to model attribute', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromElement( 'strong' )
 			.fromElement( 'b' )
 			.fromAttribute( 'class', 'bold' )
@@ -190,13 +190,13 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from pattern to model element', () => {
-		BuildViewConverterFor( dispatcher ).from(
+		buildViewConverter().for( dispatcher ).from(
 			{ name: 'span', class: 'megatron', attribute: { head: 'megatron', body: 'megatron', legs: 'megatron' } }
 		).toElement( 'MEGATRON' );
 
 		// Adding callbacks later so they are called later. MEGATRON callback is more important.
-		BuildViewConverterFor( dispatcher ).fromElement( 'span' ).toElement( 'span' );
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'span' ).toElement( 'span' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
 		let result;
 
@@ -242,10 +242,10 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from pattern to model attribute', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'span' ).toElement( 'span' );
+		buildViewConverter().for( dispatcher ).fromElement( 'span' ).toElement( 'span' );
 
 		// This time without name so default span converter will convert children.
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.from( { class: 'megatron', attribute: { head: 'megatron', body: 'megatron', legs: 'megatron' } } )
 			.toAttribute( 'transformer', 'megatron' );
 
@@ -262,10 +262,10 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should set different priorities for `toElement` and `toAttribute` conversion', () => {
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromAttribute( 'class' )
 			.toAttribute( ( viewElement ) => ( { key: 'class', value: viewElement.getAttribute( 'class' ) } ) );
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
 		let result = dispatcher.convert( new ViewContainerElement( 'p', { class: 'myClass' }, new ViewText( 'foo' ) ), objWithContext );
 		modelRoot.appendChildren( result );
@@ -275,8 +275,8 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should overwrite default priorities for converters', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher )
 			.fromAttribute( 'class' )
 			.toAttribute( ( viewElement ) => ( { key: 'class', value: viewElement.getAttribute( 'class' ) } ) );
 
@@ -286,7 +286,7 @@ describe( 'View converter builder', () => {
 		modelRoot.appendChildren( result );
 		expect( modelToString( result ) ).to.equal( '<paragraph class="myClass">foo</paragraph>' );
 
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.from( { name: 'p', class: 'myClass' } ).withPriority( -1 ) // Default for `toElement` is 0.
 			.toElement( 'customP' );
 
@@ -297,15 +297,15 @@ describe( 'View converter builder', () => {
 
 	it( 'should overwrite default consumed values', () => {
 		// Converter (1).
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
 		// Converter (2).
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.from( { name: 'p', class: 'decorated' } ).consuming( { class: 'decorated' } )
 			.toAttribute( 'decorated', true );
 
 		// Converter (3).
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.fromAttribute( 'class', 'small' ).consuming( { class: 'small' } )
 			.toAttribute( 'size', 'small' );
 
@@ -322,12 +322,12 @@ describe( 'View converter builder', () => {
 
 	it( 'should convert from matcher instance to model', () => {
 		// Universal class converter, synonymous to .fromAttribute( 'class' ).
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.from( new ViewMatcher( { class: /.*/ } ) )
 			.toAttribute( ( viewElement ) => ( { key: 'class', value: viewElement.getAttribute( 'class' ) } ) );
 
 		// Universal element converter.
-		BuildViewConverterFor( dispatcher )
+		buildViewConverter().for( dispatcher )
 			.from( new ViewMatcher( { name: /.*/ } ) )
 			.toElement( ( viewElement ) => new ModelElement( viewElement.name ) );
 
@@ -342,9 +342,9 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should filter out structure that is wrong with schema', () => {
-		BuildViewConverterFor( dispatcher ).fromElement( 'strong' ).toAttribute( 'bold', true );
-		BuildViewConverterFor( dispatcher ).fromElement( 'div' ).toElement( 'div' );
-		BuildViewConverterFor( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
+		buildViewConverter().for( dispatcher ).fromElement( 'strong' ).toAttribute( 'bold', true );
+		buildViewConverter().for( dispatcher ).fromElement( 'div' ).toElement( 'div' );
+		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
 		schema.disallow( { name: '$text', attributes: 'bold', inside: 'paragraph' } );
 		schema.disallow( { name: 'div', inside: '$root' } );

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

@@ -9,7 +9,7 @@ import ModelDocument from '/ckeditor5/engine/model/document.js';
 import DataController from '/ckeditor5/engine/datacontroller.js';
 import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
 
-import BuildViewConverterFor  from '/ckeditor5/engine/conversion/view-converter-builder.js';
+import buildViewConverter  from '/ckeditor5/engine/conversion/buildviewconverter.js';
 import buildModelConverter  from '/ckeditor5/engine/conversion/buildmodelconverter.js';
 
 import { getData, setData, stringify } from '/tests/engine/_utils/model.js';
@@ -50,7 +50,7 @@ describe( 'DataController', () => {
 		it( 'should set paragraph', () => {
 			schema.registerItem( 'paragraph', '$block' );
 
-			BuildViewConverterFor( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
+			buildViewConverter().for( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
 
 			const model = data.parse( '<p>foo<b>bar</b></p>' );
 
@@ -60,7 +60,7 @@ describe( 'DataController', () => {
 		it( 'should set two paragraphs', () => {
 			schema.registerItem( 'paragraph', '$block' );
 
-			BuildViewConverterFor( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
+			buildViewConverter().for( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
 
 			const model = data.parse( '<p>foo</p><p>bar</p>' );
 
@@ -72,8 +72,8 @@ describe( 'DataController', () => {
 			schema.registerItem( 'paragraph', '$block' );
 			schema.allow( { name: '$text', attributes: [ 'bold' ], inside: '$block' } );
 
-			BuildViewConverterFor( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
-			BuildViewConverterFor( data.viewToModel ).fromElement( 'b' ).toAttribute( 'bold', true );
+			buildViewConverter().for( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
+			buildViewConverter().for( data.viewToModel ).fromElement( 'b' ).toAttribute( 'bold', true );
 
 			const model = data.parse( '<p>foo<b>bar</b></p>' );
 

+ 2 - 2
packages/ckeditor5-engine/tests/tickets/475/475.js

@@ -13,7 +13,7 @@ import Range from '/ckeditor5/engine/model/range.js';
 import LivePosition from '/ckeditor5/engine/model/liveposition.js';
 
 import buildModelConverter from '/ckeditor5/engine/conversion/buildmodelconverter.js';
-import BuildViewConverterFor from '/ckeditor5/engine/conversion/view-converter-builder.js';
+import buildViewConverter from '/ckeditor5/engine/conversion/buildviewconverter.js';
 
 import AttributeElement from '/ckeditor5/engine/view/attributeelement.js';
 
@@ -32,7 +32,7 @@ export default class Link extends Feature {
 			.toElement( ( href ) => new AttributeElement( 'a', { href } ) );
 
 		// Build converter from view to model for data pipeline.
-		BuildViewConverterFor( data.viewToModel )
+		buildViewConverter().for( data.viewToModel )
 			.fromElement( 'a' )
 			.toAttribute( ( viewElement ) => ( { key: 'link', value: viewElement.getAttribute( 'href' ) } ) );
 	}