/** * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ /* globals document */ import BalloonToolbarEditor from '../ckeditor'; import BaseBalloonToolbarEditor from '@ckeditor/ckeditor5-editor-balloon-toolbar/src/balloontoolbareditor'; describe( 'BalloonToolbarEditor build', () => { let editor, editorElement; beforeEach( () => { editorElement = document.createElement( 'div' ); editorElement.innerHTML = '
foo bar
'; document.body.appendChild( editorElement ); } ); afterEach( () => { editorElement.remove(); } ); describe( 'buid', () => { it( 'contains plugins', () => { expect( BalloonToolbarEditor.build.plugins ).to.not.be.empty; } ); it( 'contains config', () => { expect( BalloonToolbarEditor.build.config.toolbar ).to.not.be.empty; } ); } ); describe( 'create()', () => { beforeEach( () => { return BalloonToolbarEditor.create( editorElement ) .then( newEditor => { editor = newEditor; } ); } ); afterEach( () => { return editor.destroy(); } ); it( 'creates an instance which inherits from the BalloonToolbarEditor', () => { expect( editor ).to.be.instanceof( BalloonToolbarEditor ); expect( editor ).to.be.instanceof( BaseBalloonToolbarEditor ); } ); it( 'loads data from the editor element', () => { expect( editor.getData() ).to.equal( 'foo bar
' ); } ); } ); describe( 'destroy()', () => { beforeEach( () => { return BalloonToolbarEditor.create( editorElement ) .then( newEditor => { editor = newEditor; } ); } ); it( 'sets the data back to the editor element', () => { editor.setData( 'foo
' ); return editor.destroy() .then( () => { expect( editorElement.innerHTML ).to.equal( 'foo
' ); } ); } ); } ); describe( 'plugins', () => { 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
