/** * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ /* globals document */ import DecoupledDocumentEditor from '../src/ckeditor'; import DecoupledEditor from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor'; describe( 'DecoupledDocumentEditor build', () => { let editor, editorData; beforeEach( () => { editorData = '
foo bar
'; } ); afterEach( () => { editor = null; } ); describe( 'buid', () => { it( 'contains plugins', () => { expect( DecoupledDocumentEditor.build.plugins ).to.not.be.empty; } ); it( 'contains config', () => { expect( DecoupledDocumentEditor.build.config.toolbar ).to.not.be.empty; } ); } ); describe( 'create()', () => { beforeEach( () => { return DecoupledDocumentEditor.create( editorData ) .then( newEditor => { editor = newEditor; } ); } ); afterEach( () => { return editor.destroy(); } ); it( 'creates an instance which inherits from the DecoupledDocumentEditor', () => { expect( editor ).to.be.instanceof( DecoupledDocumentEditor ); expect( editor ).to.be.instanceof( DecoupledEditor ); } ); it( 'loads passed data', () => { expect( editor.getData() ).to.equal( 'foo bar
' ); } ); it( 'does not define the UI DOM structure', () => { expect( editor.ui.view.element ).to.be.null; expect( editor.ui.view.toolbar.element.parentElement ).to.be.null; expect( editor.ui.view.editable.element.parentElement ).to.be.null; } ); } ); describe( 'destroy()', () => { beforeEach( () => { return DecoupledDocumentEditor.create( editorData ) .then( newEditor => { editor = newEditor; } ); } ); } ); describe( 'plugins', () => { beforeEach( () => { return DecoupledDocumentEditor.create( editorData ) .then( newEditor => { editor = newEditor; } ); } ); afterEach( () => { return editor.destroy(); } ); it( 'paragraph works', () => { const data = 'Some text inside a paragraph.
'; editor.setData( data ); expect( editor.getData() ).to.equal( data ); } ); it( 'basic-styles work', () => { const data = [ '', 'Test:strong', 'Test:i', '
' ].join( '' ); editor.setData( data ); expect( editor.getData() ).to.equal( data ); } ); it( 'block-quote works', () => { const data = ''; editor.setData( data ); expect( editor.getData() ).to.equal( data ); } ); it( 'heading works', () => { const data = [ 'Quote
