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

Other: Remove silent validation in commands.

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
96d696e5b0

+ 1 - 5
packages/ckeditor5-heading/src/headingcommand.js

@@ -63,16 +63,12 @@ export default class HeadingCommand extends Command {
 	 * @param {String} options.value Name of the element which this command will apply in the model.
 	 * @fires execute
 	 */
-	execute( options = {} ) {
+	execute( options ) {
 		const model = this.editor.model;
 		const document = model.document;
 
 		const modelElement = options.value;
 
-		if ( !this.modelElements.includes( modelElement ) ) {
-			return;
-		}
-
 		model.change( writer => {
 			const blocks = Array.from( document.selection.getSelectedBlocks() )
 				.filter( block => {

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

@@ -176,13 +176,13 @@ describe( 'HeadingCommand', () => {
 
 		it( 'should do nothing on non-registered model elements', () => {
 			setData( model, '<heading1>[]</heading1>' );
-			command.execute( { value: 'paragraph' } );
+			command.execute( { value: 'heading5' } );
 
 			expect( getData( model ) ).to.equal( '<heading1>[]</heading1>' );
 			expect( command.value ).to.equal( 'heading1' );
 		} );
 
-		it( 'should do nothing when empty value is passed', () => {
+		it.skip( 'should do nothing when empty value is passed', () => {
 			setData( model, '<heading1>[]</heading1>' );
 			command.execute();