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

Renamed 'format'->'option' in the entire ckeditor5-heading package.

Aleksander Nowodzinski 8 лет назад
Родитель
Сommit
da2af58dfa

+ 7 - 8
packages/ckeditor5-heading/src/heading.js

@@ -36,14 +36,13 @@ export default class Heading extends Plugin {
 	init() {
 		const editor = this.editor;
 		const command = editor.commands.get( 'heading' );
-		const formats = command.formats;
+		const options = command.options;
 		const collection = new Collection();
 
-		// Add formats to collection.
-		for ( const { id, label } of formats ) {
+		// Add options to collection.
+		for ( const { id, label } of options ) {
 			collection.add( new Model( {
-				formatId: id,
-				label: label
+				id, label
 			} ) );
 		}
 
@@ -55,15 +54,15 @@ export default class Heading extends Plugin {
 
 		// Bind dropdown model to command.
 		dropdownModel.bind( 'isEnabled' ).to( command, 'isEnabled' );
-		dropdownModel.bind( 'label' ).to( command, 'value', format => format.label );
+		dropdownModel.bind( 'label' ).to( command, 'value', option => option.label );
 
 		// Register UI component.
 		editor.ui.componentFactory.add( 'headings', ( locale ) => {
 			const dropdown = createListDropdown( dropdownModel, locale );
 
 			// Execute command when an item from the dropdown is selected.
-			this.listenTo( dropdown, 'execute', ( { source: { formatId } } ) => {
-				editor.execute( 'heading', { formatId } );
+			this.listenTo( dropdown, 'execute', ( { source: { id } } ) => {
+				editor.execute( 'heading', { id } );
 				editor.editing.view.focus();
 			} );
 

+ 31 - 31
packages/ckeditor5-heading/src/headingcommand.js

@@ -20,40 +20,40 @@ export default class HeadingCommand extends Command {
 	 * Creates an instance of the command.
 	 *
 	 * @param {module:core/editor/editor~Editor} editor Editor instance.
-	 * @param {Array.<module:heading/headingcommand~HeadingFormat>} formats Heading formats to be used by the command instance.
+	 * @param {Array.<module:heading/headingcommand~HeadingOption>} options Heading options to be used by the command instance.
 	 */
-	constructor( editor, formats ) {
+	constructor( editor, options ) {
 		super( editor );
 
 		/**
-		 * Heading formats used by this command.
+		 * Heading options used by this command.
 		 *
 		 * @readonly
-		 * @member {module:heading/headingcommand~HeadingFormat}
+		 * @member {module:heading/headingcommand~HeadingOption}
 		 */
-		this.formats = formats;
+		this.options = options;
 
 		/**
-		 * The currently selected heading format.
+		 * The currently selected heading option.
 		 *
 		 * @readonly
 		 * @observable
-		 * @member {module:heading/headingcommand~HeadingFormat} #value
+		 * @member {module:heading/headingcommand~HeadingOption} #value
 		 */
-		this.set( 'value', this.defaultFormat );
+		this.set( 'value', this.defaultOption );
 
 		// Update current value each time changes are done on document.
 		this.listenTo( editor.document, 'changesDone', () => this._updateValue() );
 	}
 
 	/**
-	 * The default format.
+	 * The default option.
 	 *
-	 * @member {module:heading/headingcommand~HeadingFormat} #defaultFormat
+	 * @member {module:heading/headingcommand~HeadingOption} #defaultOption
 	 */
-	get defaultFormat() {
+	get defaultOption() {
 		// See https://github.com/ckeditor/ckeditor5/issues/98.
-		return this._getFormatById( this.editor.config.get( 'heading.defaultFormatId' ) );
+		return this._getFormatById( this.editor.config.get( 'heading.defaultOptionId' ) );
 	}
 
 	/**
@@ -61,16 +61,16 @@ export default class HeadingCommand extends Command {
 	 *
 	 * @protected
 	 * @param {Object} [options] Options for executed command.
-	 * @param {String} [options.formatId] The identifier of the heading format that should be applied. It should be one of the
-	 * {@link module:heading/headingcommand~HeadingFormat heading formats} provided to the command constructor. If this parameter is not
+	 * @param {String} [options.id] The identifier of the heading option that should be applied. It should be one of the
+	 * {@link module:heading/headingcommand~HeadingOption heading options} provided to the command constructor. If this parameter is not
 	 * provided,
-	 * the value from {@link #defaultFormat defaultFormat} will be used.
+	 * the value from {@link #defaultOption defaultOption} will be used.
 	 * @param {module:engine/model/batch~Batch} [options.batch] Batch to collect all the change steps.
 	 * New batch will be created if this option is not set.
 	 */
 	_doExecute( options = {} ) {
-		// TODO: What should happen if format is not found?
-		const formatId = options.formatId || this.defaultFormat.id;
+		// TODO: What should happen if option is not found?
+		const id = options.id || this.defaultOption.id;
 		const doc = this.editor.document;
 		const selection = doc.selection;
 		const startPosition = selection.getFirstPosition();
@@ -78,10 +78,10 @@ export default class HeadingCommand extends Command {
 		// Storing selection ranges and direction to fix selection after renaming. See ckeditor5-engine#367.
 		const ranges = [ ...selection.getRanges() ];
 		const isSelectionBackward = selection.isBackward;
-		// If current format is same as new format - toggle already applied format back to default one.
-		const shouldRemove = ( formatId === this.value.id );
+		// If current option is same as new option - toggle already applied option back to default one.
+		const shouldRemove = ( id === this.value.id );
 
-		// Collect elements to change format.
+		// Collect elements to change option.
 		// This implementation may not be future proof but it's satisfactory at this stage.
 		if ( selection.isCollapsed ) {
 			const block = findTopmostBlock( startPosition );
@@ -107,15 +107,15 @@ export default class HeadingCommand extends Command {
 			const batch = options.batch || doc.batch();
 
 			for ( let element of elements ) {
-				// When removing applied format.
+				// When removing applied option.
 				if ( shouldRemove ) {
-					if ( element.name === formatId ) {
-						batch.rename( element, this.defaultFormat.id );
+					if ( element.name === id ) {
+						batch.rename( element, this.defaultOption.id );
 					}
 				}
-				// When applying new format.
+				// When applying new option.
 				else {
-					batch.rename( element, formatId );
+					batch.rename( element, id );
 				}
 			}
 
@@ -126,14 +126,14 @@ export default class HeadingCommand extends Command {
 	}
 
 	/**
-	 * Returns the format by a given ID.
+	 * Returns the option by a given ID.
 	 *
 	 * @private
 	 * @param {String} id
-	 * @returns {module:heading/headingcommand~HeadingFormat}
+	 * @returns {module:heading/headingcommand~HeadingOption}
 	 */
 	_getFormatById( id ) {
-		return this.formats.find( item => item.id === id ) || this.defaultFormat;
+		return this.options.find( item => item.id === id ) || this.defaultOption;
 	}
 
 	/**
@@ -177,10 +177,10 @@ function findTopmostBlock( position, nodeAfter = true ) {
 }
 
 /**
- * Heading format descriptor.
+ * Heading option descriptor.
  *
- * @typedef {Object} module:heading/headingcommand~HeadingFormat
+ * @typedef {Object} module:heading/headingcommand~HeadingOption
  * @property {String} id Format identifier. It will be used as the element's name in the model.
  * @property {String} viewElement The name of the view element that will be used to represent the model element in the view.
- * @property {String} label The display name of the format.
+ * @property {String} label The display name of the option.
  */

+ 29 - 28
packages/ckeditor5-heading/src/headingengine.js

@@ -29,27 +29,27 @@ export default class HeadingEngine extends Plugin {
 		const t = editor.t;
 
 		/**
-		 * A set of default localized labels for `config.heading.formats`.
+		 * A set of default localized labels for `config.heading.options`.
 		 *
 		 * @readonly
 		 * @protected
 		 * @member {Object} #_localizedFormatLabels
 		 */
 		const labels = this._localizedFormatLabels = {
-			'Paragraph': t( 'Paragraph' ),
+			Paragraph: t( 'Paragraph' ),
 			'Heading 1': t( 'Heading 1' ),
 			'Heading 2': t( 'Heading 2' ),
 			'Heading 3': t( 'Heading 3' )
 		};
 
 		editor.config.define( 'heading', {
-			formats: [
+			options: [
 				{ id: 'paragraph', element: 'p', label: labels.Paragraph },
 				{ id: 'heading1', element: 'h2', label: labels[ 'Heading 1' ] },
 				{ id: 'heading2', element: 'h3', label: labels[ 'Heading 2' ] },
 				{ id: 'heading3', element: 'h4', label: labels[ 'Heading 3' ] }
 			],
-			defaultFormatId: 'paragraph'
+			defaultOptionId: 'paragraph'
 		} );
 	}
 
@@ -67,29 +67,29 @@ export default class HeadingEngine extends Plugin {
 		const editor = this.editor;
 		const data = editor.data;
 		const editing = editor.editing;
-		const formats = this._formats;
-		const defaultFormatId = editor.config.get( 'heading.defaultFormatId' );
+		const options = this._options;
+		const defaultOptionId = editor.config.get( 'heading.defaultOptionId' );
 
-		for ( let format of formats ) {
+		for ( let option of options ) {
 			// Skip paragraph - it is defined in required Paragraph feature.
-			if ( format.id !== defaultFormatId ) {
+			if ( option.id !== defaultOptionId ) {
 				// Schema.
-				editor.document.schema.registerItem( format.id, '$block' );
+				editor.document.schema.registerItem( option.id, '$block' );
 
 				// Build converter from model to view for data and editing pipelines.
 				buildModelConverter().for( data.modelToView, editing.modelToView )
-					.fromElement( format.id )
-					.toElement( format.element );
+					.fromElement( option.id )
+					.toElement( option.element );
 
 				// Build converter from view to model for data pipeline.
 				buildViewConverter().for( data.viewToModel )
-					.fromElement( format.element )
-					.toElement( format.id );
+					.fromElement( option.element )
+					.toElement( option.id );
 			}
 		}
 
 		// Register the heading command.
-		const command = new HeadingCommand( editor, formats );
+		const command = new HeadingCommand( editor, options );
 		editor.commands.set( 'heading', command );
 	}
 
@@ -103,44 +103,45 @@ export default class HeadingEngine extends Plugin {
 		const editor = this.editor;
 		const command = editor.commands.get( 'heading' );
 		const enterCommand = editor.commands.get( 'enter' );
-		const formats = this._formats;
+		const options = this._options;
 
 		if ( enterCommand ) {
 			this.listenTo( enterCommand, 'afterExecute', ( evt, data ) => {
 				const positionParent = editor.document.selection.getFirstPosition().parent;
 				const batch = data.batch;
-				const isHeading = formats.some( format => format.id == positionParent.name );
+				const isHeading = options.some( option => option.id == positionParent.name );
 
-				if ( isHeading && positionParent.name != command.defaultFormat.id && positionParent.childCount === 0 ) {
-					batch.rename( positionParent, command.defaultFormat.id );
+				if ( isHeading && positionParent.name != command.defaultOption.id && positionParent.childCount === 0 ) {
+					batch.rename( positionParent, command.defaultOption.id );
 				}
 			} );
 		}
 	}
 
 	/**
-	 * A set of formats as defined in `config.heading.formats`.
+	 * A set of options as defined in `config.heading.options`, considering
+	 * editor localization.
 	 *
 	 * @readonly
 	 * @protected
-	 * @type {Array.<module:heading/headingcommand~HeadingFormat>}
+	 * @type {Array.<module:heading/headingcommand~HeadingOption>}
 	 */
-	get _formats() {
+	get _options() {
 		const editor = this.editor;
 
-		return editor.config.get( 'heading.formats' )
-			.map( format => {
+		return editor.config.get( 'heading.options' )
+			.map( option => {
 				// Translate `label`s in the config to with current locale using `#_localizedFormatLabels` because
 				// there's no way to use t() when the config is defined i.e. when the editor does not
 				// exist yet.
-				if ( this._localizedFormatLabels[ format.label ] ) {
-					// Clone the format to avoid altering the original `config.heading.formats`.
-					format = Object.assign( {}, format, {
-						label: this._localizedFormatLabels[ format.label ]
+				if ( this._localizedFormatLabels[ option.label ] ) {
+					// Clone the option to avoid altering the original `config.heading.options`.
+					option = Object.assign( {}, option, {
+						label: this._localizedFormatLabels[ option.label ]
 					} );
 				}
 
-				return format;
+				return option;
 			} );
 	}
 }

+ 7 - 7
packages/ckeditor5-heading/tests/heading.js

@@ -50,7 +50,7 @@ describe( 'Heading', () => {
 	} );
 
 	describe( 'init()', () => {
-		it( 'should register formats feature component', () => {
+		it( 'should register options feature component', () => {
 			const dropdown = editor.ui.componentFactory.create( 'headings' );
 
 			expect( dropdown ).to.be.instanceOf( DropdownView );
@@ -63,11 +63,11 @@ describe( 'Heading', () => {
 			const executeSpy = testUtils.sinon.spy( editor, 'execute' );
 			const dropdown = editor.ui.componentFactory.create( 'headings' );
 
-			dropdown.formatId = 'foo';
+			dropdown.id = 'foo';
 			dropdown.fire( 'execute' );
 
 			sinon.assert.calledOnce( executeSpy );
-			sinon.assert.calledWithExactly( executeSpy, 'heading', { formatId: 'foo' } );
+			sinon.assert.calledWithExactly( executeSpy, 'heading', { id: 'foo' } );
 		} );
 
 		it( 'should focus view after command execution', () => {
@@ -94,7 +94,7 @@ describe( 'Heading', () => {
 
 			it( 'label', () => {
 				expect( dropdown.buttonView.label ).to.equal( 'Paragraph' );
-				command.value = command.formats[ 1 ];
+				command.value = command.options[ 1 ];
 				expect( dropdown.buttonView.label ).to.equal( 'Heading 1' );
 			} );
 		} );
@@ -110,7 +110,7 @@ describe( 'Heading', () => {
 					toolbar: [ 'heading' ],
 					lang: 'pl',
 					heading: {
-						formats: [
+						options: [
 							{ id: 'paragraph', element: 'p', label: 'Paragraph' },
 							{ id: 'heading1', element: 'h2', label: 'Heading 1' },
 							{ id: 'heading2', element: 'h3', label: 'Not automatically localized' }
@@ -125,7 +125,7 @@ describe( 'Heading', () => {
 			} );
 
 			it( 'does not alter the original config', () => {
-				expect( editor.config.get( 'heading.formats' ) ).to.deep.equal( [
+				expect( editor.config.get( 'heading.options' ) ).to.deep.equal( [
 					{ id: 'paragraph', element: 'p', label: 'Paragraph' },
 					{ id: 'heading1', element: 'h2', label: 'Heading 1' },
 					{ id: 'heading2', element: 'h3', label: 'Not automatically localized' }
@@ -136,7 +136,7 @@ describe( 'Heading', () => {
 				const buttonView = dropdown.buttonView;
 
 				expect( buttonView.label ).to.equal( 'Akapit' );
-				command.value = command.formats[ 1 ];
+				command.value = command.options[ 1 ];
 				expect( buttonView.label ).to.equal( 'Nagłówek 1' );
 			} );
 

+ 30 - 30
packages/ckeditor5-heading/tests/headingcommand.js

@@ -8,7 +8,7 @@ import HeadingCommand from '../src/headingcommand';
 import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
-const formats = [
+const options = [
 	{ id: 'paragraph', element: 'p', default: true },
 	{ id: 'heading1', element: 'h2' },
 	{ id: 'heading2', element: 'h3' },
@@ -21,17 +21,17 @@ describe( 'HeadingCommand', () => {
 	beforeEach( () => {
 		return ModelTestEditor.create( {
 			heading: {
-				defaultFormatId: 'paragraph'
+				defaultOptionId: 'paragraph'
 			}
 		} )
 		.then( newEditor => {
 			editor = newEditor;
 			document = editor.document;
-			command = new HeadingCommand( editor, formats );
+			command = new HeadingCommand( editor, options );
 			schema = document.schema;
 
-			for ( let format of formats ) {
-				schema.registerItem( format.id, '$block' );
+			for ( let option of options ) {
+				schema.registerItem( option.id, '$block' );
 			}
 
 			root = document.getRoot();
@@ -43,34 +43,34 @@ describe( 'HeadingCommand', () => {
 	} );
 
 	describe( 'value', () => {
-		for ( let format of formats ) {
-			test( format );
+		for ( let option of options ) {
+			test( option );
 		}
 
-		function test( format ) {
-			it( `equals ${ format.id } when collapsed selection is placed inside ${ format.id } element`, () => {
-				setData( document, `<${ format.id }>foobar</${ format.id }>` );
+		function test( option ) {
+			it( `equals ${ option.id } when collapsed selection is placed inside ${ option.id } element`, () => {
+				setData( document, `<${ option.id }>foobar</${ option.id }>` );
 				const element = root.getChild( 0 );
 				document.selection.addRange( Range.createFromParentsAndOffsets( element, 3, element, 3 ) );
 
-				expect( command.value ).to.equal( format );
+				expect( command.value ).to.equal( option );
 			} );
 		}
 
-		it( 'should be equal to defaultFormat if format has not been found', () => {
+		it( 'should be equal to defaultOption if option has not been found', () => {
 			schema.registerItem( 'div', '$block' );
 			setData( document, '<div>xyz</div>' );
 			const element = root.getChild( 0 );
 			document.selection.addRange( Range.createFromParentsAndOffsets( element, 1, element, 1 ) );
 
-			expect( command.value ).to.equal( command.defaultFormat );
+			expect( command.value ).to.equal( command.defaultOption );
 		} );
 	} );
 
 	describe( '_doExecute', () => {
 		it( 'should update value after execution', () => {
 			setData( document, '<paragraph>[]</paragraph>' );
-			command._doExecute( { formatId: 'heading1' } );
+			command._doExecute( { id: 'heading1' } );
 
 			expect( getData( document ) ).to.equal( '<heading1>[]</heading1>' );
 			expect( command.value ).to.be.object;
@@ -92,11 +92,11 @@ describe( 'HeadingCommand', () => {
 		} );
 
 		describe( 'collapsed selection', () => {
-			let convertTo = formats[ formats.length - 1 ];
+			let convertTo = options[ options.length - 1 ];
 
-			for ( let format of formats ) {
-				test( format, convertTo );
-				convertTo = format;
+			for ( let option of options ) {
+				test( option, convertTo );
+				convertTo = option;
 			}
 
 			it( 'uses paragraph as default value', () => {
@@ -106,9 +106,9 @@ describe( 'HeadingCommand', () => {
 				expect( getData( document ) ).to.equal( '<paragraph>foo[]bar</paragraph>' );
 			} );
 
-			it( 'converts to default format when executed with already applied format', () => {
+			it( 'converts to default option when executed with already applied option', () => {
 				setData( document, '<heading1>foo[]bar</heading1>' );
-				command._doExecute( { formatId: 'heading1' } );
+				command._doExecute( { id: 'heading1' } );
 
 				expect( getData( document ) ).to.equal( '<paragraph>foo[]bar</paragraph>' );
 			} );
@@ -118,7 +118,7 @@ describe( 'HeadingCommand', () => {
 				schema.allow( { name: '$text', inside: 'inlineImage' } );
 
 				setData( document, '<heading1><inlineImage>foo[]</inlineImage>bar</heading1>' );
-				command._doExecute( { formatId: 'heading1' } );
+				command._doExecute( { id: 'heading1' } );
 
 				expect( getData( document ) ).to.equal( '<paragraph><inlineImage>foo[]</inlineImage>bar</paragraph>' );
 			} );
@@ -126,7 +126,7 @@ describe( 'HeadingCommand', () => {
 			function test( from, to ) {
 				it( `converts ${ from.id } to ${ to.id } on collapsed selection`, () => {
 					setData( document, `<${ from.id }>foo[]bar</${ from.id }>` );
-					command._doExecute( { formatId: to.id } );
+					command._doExecute( { id: to.id } );
 
 					expect( getData( document ) ).to.equal( `<${ to.id }>foo[]bar</${ to.id }>` );
 				} );
@@ -134,25 +134,25 @@ describe( 'HeadingCommand', () => {
 		} );
 
 		describe( 'non-collapsed selection', () => {
-			let convertTo = formats[ formats.length - 1 ];
+			let convertTo = options[ options.length - 1 ];
 
-			for ( let format of formats ) {
-				test( format, convertTo );
-				convertTo = format;
+			for ( let option of options ) {
+				test( option, convertTo );
+				convertTo = option;
 			}
 
 			it( 'converts all elements where selection is applied', () => {
 				setData( document, '<heading1>foo[</heading1><heading2>bar</heading2><heading2>]baz</heading2>' );
-				command._doExecute( { formatId: 'paragraph' } );
+				command._doExecute( { id: 'paragraph' } );
 
 				expect( getData( document ) ).to.equal(
 					'<paragraph>foo[</paragraph><paragraph>bar</paragraph><paragraph>]baz</paragraph>'
 				);
 			} );
 
-			it( 'resets to default value all elements with same format', () => {
+			it( 'resets to default value all elements with same option', () => {
 				setData( document, '<heading1>foo[</heading1><heading1>bar</heading1><heading2>baz</heading2>]' );
-				command._doExecute( { formatId: 'heading1' } );
+				command._doExecute( { id: 'heading1' } );
 
 				expect( getData( document ) ).to.equal(
 					'<paragraph>foo[</paragraph><paragraph>bar</paragraph><heading2>baz</heading2>]'
@@ -162,7 +162,7 @@ describe( 'HeadingCommand', () => {
 			function test( from, to ) {
 				it( `converts ${ from.id } to ${ to.id } on non-collapsed selection`, () => {
 					setData( document, `<${ from.id }>foo[bar</${ from.id }><${ from.id }>baz]qux</${ from.id }>` );
-					command._doExecute( { formatId: to.id } );
+					command._doExecute( { id: to.id } );
 
 					expect( getData( document ) ).to.equal( `<${ to.id }>foo[bar</${ to.id }><${ to.id }>baz]qux</${ to.id }>` );
 				} );

+ 14 - 14
packages/ckeditor5-heading/tests/headingengine.js

@@ -54,7 +54,7 @@ describe( 'HeadingEngine', () => {
 		expect( document.schema.check( { name: '$inline', inside: 'heading3' } ) ).to.be.true;
 	} );
 
-	it( 'should register format command', () => {
+	it( 'should register option command', () => {
 		expect( editor.commands.has( 'heading' ) ).to.be.true;
 		const command = editor.commands.get( 'heading' );
 
@@ -82,7 +82,7 @@ describe( 'HeadingEngine', () => {
 		expect( editor.getData() ).to.equal( '<h4>foobar</h4>' );
 	} );
 
-	it( 'should make enter command insert a defaultFormat block if selection ended at the end of heading block', () => {
+	it( 'should make enter command insert a defaultOption block if selection ended at the end of heading block', () => {
 		editor.setData( '<h2>foobar</h2>' );
 		document.selection.collapse( document.getRoot().getChild( 0 ), 'end' );
 
@@ -102,10 +102,10 @@ describe( 'HeadingEngine', () => {
 	} );
 
 	describe( 'config', () => {
-		describe( 'formats', () => {
+		describe( 'options', () => {
 			describe( 'default value', () => {
 				it( 'should be set', () => {
-					expect( editor.config.get( 'heading.formats' ) ).to.deep.equal( [
+					expect( editor.config.get( 'heading.options' ) ).to.deep.equal( [
 						{ id: 'paragraph', element: 'p', label: 'Paragraph' },
 						{ id: 'heading1', element: 'h2', label: 'Heading 1' },
 						{ id: 'heading2', element: 'h3', label: 'Heading 2' },
@@ -119,7 +119,7 @@ describe( 'HeadingEngine', () => {
 						lang: 'pl',
 					} )
 					.then( editor => {
-						expect( editor.config.get( 'heading.formats' ) ).to.deep.equal( [
+						expect( editor.config.get( 'heading.options' ) ).to.deep.equal( [
 							{ id: 'paragraph', element: 'p', label: 'Akapit' },
 							{ id: 'heading1', element: 'h2', label: 'Nagłówek 1' },
 							{ id: 'heading2', element: 'h3', label: 'Nagłówek 2' },
@@ -129,8 +129,8 @@ describe( 'HeadingEngine', () => {
 				} );
 			} );
 
-			it( 'should customize formats', () => {
-				const formats = [
+			it( 'should customize options', () => {
+				const options = [
 					{ id: 'paragraph', element: 'p', label: 'Paragraph' },
 					{ id: 'h4', element: 'h4', label: 'H4' }
 				];
@@ -138,13 +138,13 @@ describe( 'HeadingEngine', () => {
 				return VirtualTestEditor.create( {
 					plugins: [ Enter, HeadingEngine ],
 					heading: {
-						formats: formats
+						options: options
 					}
 				} )
 				.then( editor => {
 					document = editor.document;
 
-					expect( editor.commands.get( 'heading' ).formats ).to.deep.equal( formats );
+					expect( editor.commands.get( 'heading' ).options ).to.deep.equal( options );
 
 					expect( document.schema.hasItem( 'paragraph' ) ).to.be.true;
 					expect( document.schema.hasItem( 'h4' ) ).to.be.true;
@@ -156,20 +156,20 @@ describe( 'HeadingEngine', () => {
 			} );
 		} );
 
-		describe( 'defaultFormatId', () => {
+		describe( 'defaultOptionId', () => {
 			it( 'should have default value', () => {
-				expect( editor.config.get( 'heading.defaultFormatId' ) ).to.equal( 'paragraph' );
+				expect( editor.config.get( 'heading.defaultOptionId' ) ).to.equal( 'paragraph' );
 			} );
 
-			it( 'should customize formats', () => {
+			it( 'should customize options', () => {
 				return VirtualTestEditor.create( {
 					plugins: [ Enter, HeadingEngine ],
 					heading: {
-						formats: [
+						options: [
 							{ id: 'foo', element: 'f', label: 'Foo' },
 							{ id: 'bar', element: 'b', label: 'Bar' }
 						],
-						defaultFormatId: 'bar'
+						defaultOptionId: 'bar'
 					}
 				} )
 				.then( editor => {