| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- import BlockQuoteEngine from '../src/blockquoteengine';
- import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
- import ListEngine from '@ckeditor/ckeditor5-list/src/listengine';
- 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 BlockQuoteCommand from '../src/blockquotecommand';
- describe( 'BlockQuoteEngine', () => {
- let editor, model;
- beforeEach( () => {
- return VirtualTestEditor
- .create( {
- plugins: [ BlockQuoteEngine, Paragraph ]
- } )
- .then( newEditor => {
- editor = newEditor;
- model = editor.model;
- } );
- } );
- afterEach( () => {
- return editor.destroy();
- } );
- it( 'adds a blockQuote command', () => {
- expect( editor.commands.get( 'blockQuote' ) ).to.be.instanceOf( BlockQuoteCommand );
- } );
- it( 'allows for blockQuote in the $root', () => {
- expect( model.schema.checkChild( [ '$root' ], 'blockQuote' ) ).to.be.true;
- } );
- it( 'allows for $block in blockQuote', () => {
- expect( model.schema.checkChild( [ 'blockQuote' ], '$block' ) ).to.be.true;
- expect( model.schema.checkChild( [ 'blockQuote' ], 'paragraph' ) ).to.be.true;
- } );
- it( 'adds converters to the data pipeline', () => {
- const data = '<blockquote><p>x</p></blockquote>';
- editor.setData( data );
- expect( getModelData( model ) ).to.equal( '<blockQuote><paragraph>[]x</paragraph></blockQuote>' );
- expect( editor.getData() ).to.equal( data );
- } );
- it( 'adds a converter to the view pipeline', () => {
- setModelData( model, '<blockQuote><paragraph>x</paragraph></blockQuote>' );
- expect( editor.getData() ).to.equal( '<blockquote><p>x</p></blockquote>' );
- } );
- it( 'allows list items inside blockQuote', () => {
- return VirtualTestEditor
- .create( {
- plugins: [ BlockQuoteEngine, Paragraph, ListEngine ]
- } )
- .then( editor => {
- editor.setData( '<blockquote><ul><li>xx</li></ul></blockquote>' );
- expect( editor.getData() ).to.equal( '<blockquote><ul><li>xx</li></ul></blockquote>' );
- } );
- } );
- } );
|