/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
import AlignmentEditing from '../src/alignmentediting';
import AlignmentCommand from '../src/alignmentcommand';
import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter';
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
import Command from '@ckeditor/ckeditor5-core/src/command';
describe( 'AlignmentCommand', () => {
let editor, doc, command;
beforeEach( () => {
return VirtualTestEditor
.create( {
plugins: [ AlignmentEditing ]
} )
.then( newEditor => {
editor = newEditor;
doc = editor.document;
doc.schema.registerItem( 'paragraph', '$block' );
doc.schema.registerItem( 'heading', '$block' );
buildModelConverter().for( editor.editing.modelToView )
.fromElement( 'paragraph' )
.toElement( 'p' );
buildModelConverter().for( editor.editing.modelToView )
.fromElement( 'heading' )
.toElement( 'h' );
command = editor.commands.get( 'alignLeft' );
} );
} );
afterEach( () => {
editor.destroy();
} );
it( 'is a command', () => {
expect( AlignmentCommand.prototype ).to.be.instanceOf( Command );
expect( command ).to.be.instanceOf( Command );
} );
describe( 'value', () => {
it( 'is false when selection is not in aligned block', () => {
setModelData( doc, '
x{}x
' ); } ); } ); } ); } );