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

Removed all the creators PoCs. See #188.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
87b87ede77

+ 0 - 35
tests/_utils/ui/boxlesseditorui/boxlesseditorui.js

@@ -1,35 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import EditorUI from '/ckeditor5/ui/editorui/editorui.js';
-import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
-
-export default class BoxlessEditorUI extends EditorUI {
-	constructor( editor ) {
-		super( editor );
-
-		this.collections.add( new ControllerCollection( 'editable' ) );
-
-		/**
-		 * @private
-		 * @type {ui.View}
-		 * @property _view
-		 */
-	}
-
-	get view() {
-		return this._view;
-	}
-
-	set view( view ) {
-		if ( view ) {
-			this._view = view;
-
-			view.register( 'editable', true );
-		}
-	}
-}

+ 0 - 28
tests/_utils/ui/editableui/framed/framededitableuiiframe.js

@@ -1,28 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import EditableUI from '/ckeditor5/ui/editableui/editableui.js';
-
-/**
- * The basic implementation of an iframe-based {@link ui.editableUI.EditableUI}.
- *
- * @memberOf ui.editableUI.iframe
- * @extends ui.editableUI.EditableUI
- */
-export default class FramedEditableUIIframe extends EditableUI {
-	/**
-	 * Creates a new instance of the iframe–based {@link ui.editableUI.EditableUI EditableUI}.
-	 *
-	 * @param {ckeditor5.Editor} editor The editor instance.
-	 * @param {utils.Observable} editableModel The model for the editable.
-	 */
-	constructor( editor, editableModel ) {
-		super( editor, editableModel );
-
-		this.viewModel.bind( 'width', 'height' ).to( editor.ui );
-	}
-}

+ 0 - 104
tests/_utils/ui/editableui/framed/framededitableuiiframeview.js

@@ -1,104 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import IframeView from '/ckeditor5/ui/iframe/iframeview.js';
-import FramedEditableUIView from './framededitableuiview.js';
-
-/**
- * The basic implementation of an {@link ui.iframe.IframeView IframeView}-based
- * {@link ui.editableUI.EditableUIView}.
- *
- * @memberOf ui.editableUI.iframe
- * @extends ui.iframe.IframeView
- */
-export default class FramedEditableUIIframeView extends IframeView {
-	/**
-	 * Creates a new instance of the {@link ui.iframe.IframeView IframeView}–based
-	 * {@link ui.editableUI.EditableUIView EditableUIView}.
-	 *
-	 * @param {utils.Observable} [model] (View)Model of this View.
-	 * @param {utils.Locale} [locale] The {@link ckeditor5.Editor#locale editor's locale} instance.
-	 */
-	constructor( model, locale ) {
-		super( model, locale );
-
-		const bind = this.attributeBinder;
-
-		this.template.attributes.class.push( 'ck-editor__editable-iframe' );
-		this.template.attributes.style = [
-			'width:',
-			bind.to( 'width', ( w ) => `${w}px` ),
-			';',
-			'height:',
-			bind.to( 'height', ( h ) => `${h}px`  )
-		];
-
-		this.on( 'loaded', this._iframeLoaded, this );
-
-		/**
-		 * A view which represents the editable `<body>` element within the iframe.
-		 *
-		 * @private
-		 * @member {FramedEditableUIView} ui.editableUI.iframe#_innerView
-		 */
-	}
-
-	/**
-	 * This getter exposes the {@link ui.editable.EditableUIView#editableElement}. It points to the
-	 * `<body>` inside the `<iframe>` document, which is provided by `FramedEditableUIView`.
-	 */
-	get editableElement() {
-		return this._innerView.editableElement;
-	}
-
-	/**
-	 * Destroys the View instance and child {@link _innerView}.
-	 */
-	destroy() {
-		super.destroy();
-
-		return this._innerView.destroy();
-	}
-
-	/**
-	 * When the iframe is loaded, it creates a child view out of <body> element
-	 * and initializes it. Element of this view is exposed through {@link editableElement}.
-	 *
-	 * @protected
-	 */
-	_iframeLoaded() {
-		this._innerView = new FramedEditableUIView(
-			this.model,
-			this.locale,
-			this.element.contentDocument.body
-		);
-
-		this._innerView.init();
-
-		this._iframeDeferred.resolve();
-	}
-}
-
-/**
- * The view model interface for FramedEditableUIView.
- *
- * @memberOf ui.editableUI.iframe
- * @interface FramedEditableUIViewModel
- * @mixes utils.ObservableMixin
- */
-
-/**
- * The width of the iframe.
- *
- * @member {Number} ui.editableUI.iframe.FramedEditableUIViewModel#width
- */
-
-/**
- * The height of the iframe.
- *
- * @member {Number} ui.editableUI.iframe.FramedEditableUIViewModel#height
- */

+ 0 - 16
tests/_utils/ui/editableui/framed/framededitableuiview.js

@@ -1,16 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import EditableUIView from '/ckeditor5/ui/editableui/editableuiview.js';
-
-export default class FramedEditableUIView extends EditableUIView {
-	constructor( model, locale, editableElement ) {
-		super( model, locale, editableElement );
-
-		this.template.attributes.class.push( 'ck-editor__editable_framed' );
-	}
-}

+ 0 - 16
tests/_utils/ui/floatingtoolbar/floatingtoolbar.js

@@ -1,16 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import Toolbar from '/ckeditor5/ui/bindings/toolbar.js';
-
-export default class FloatingToolbar extends Toolbar {
-	constructor( model, view, editor ) {
-		super( model, view, editor );
-
-		model.bind( 'isVisible' ).to( editor.editables.get( model.editableName ), 'isFocused' );
-	}
-}

+ 0 - 27
tests/_utils/ui/floatingtoolbar/floatingtoolbarview.js

@@ -1,27 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import ToolbarView from '/ckeditor5/ui/toolbar/toolbarview.js';
-
-export default class FloatingToolbarView extends ToolbarView {
-	constructor( model, locale ) {
-		super( model, locale );
-
-		const bind = this.attributeBinder;
-
-		this.template.attributes.class.push(
-			bind.to( 'isVisible', value => value ? 'ck-visible' : 'ck-hidden' )
-		);
-
-		// This has a high risk of breaking if someone defines "on" in the parent template.
-		// See https://github.com/ckeditor/ckeditor5-engine/issues/219
-		this.template.on = {
-			// Added just for fun, but needed to keep the focus in the editable.
-			mousedown: ( evt ) => evt.preventDefault()
-		};
-	}
-}

+ 0 - 2
tests/ckeditor.html

@@ -1,2 +0,0 @@
-<div id="content"></div>
-<div class="editor"></div>

+ 0 - 215
tests/ckeditor.js

@@ -1,215 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* bender-tags: browser-only */
-
-'use strict';
-
-import testUtils from '/tests/ckeditor5/_utils/utils.js';
-
-import CKEDITOR from '/ckeditor.js';
-import Editor from '/ckeditor5/editor.js';
-import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
-
-const content = document.getElementById( 'content' );
-const editorConfig = { creator: 'creator-test' };
-
-testUtils.createSinonSandbox();
-testUtils.defineEditorCreatorMock( 'test' );
-
-beforeEach( () => {
-	// Destroy all editor instances.
-	while ( CKEDITOR.instances.length ) {
-		CKEDITOR.instances.get( 0 ).destroy();
-	}
-} );
-
-describe( 'create', () => {
-	it( 'should return a promise', () => {
-		expect( CKEDITOR.create( content, editorConfig ) ).to.be.instanceof( Promise );
-	} );
-
-	it( 'should create a new editor instance', () => {
-		return CKEDITOR.create( content, editorConfig ).then( ( editor ) => {
-			expect( editor ).to.be.instanceof( Editor );
-		} );
-	} );
-
-	it( 'should set configurations on the new editor', () => {
-		return CKEDITOR.create( content, { test: 1, creator: 'creator-test' } ).then( ( editor ) => {
-			expect( editor.config.test ).to.equal( 1 );
-		} );
-	} );
-
-	it( 'should add the editor to the `instances` collection', () => {
-		return CKEDITOR.create( content, editorConfig ).then( ( editor ) => {
-			expect( CKEDITOR.instances ).to.have.length( 1 );
-			expect( CKEDITOR.instances.get( 0 ) ).to.equal( editor );
-		} );
-	} );
-
-	it( 'should remove the editor from the `instances` collection on `destroy` event', () => {
-		let editor1, editor2;
-
-		// Create the first editor.
-		return CKEDITOR.create( content, editorConfig ).then( ( editor ) => {
-			editor1 = editor;
-
-			// Create the second editor.
-			return CKEDITOR.create( '.editor', editorConfig ).then( ( editor ) => {
-				editor2 = editor;
-
-				// It should have 2 editors.
-				expect( CKEDITOR.instances ).to.have.length( 2 );
-
-				// Destroy one of them.
-				editor1.destroy();
-
-				// It should have 1 editor now.
-				expect( CKEDITOR.instances ).to.have.length( 1 );
-
-				// Ensure that the remaining is the right one.
-				expect( CKEDITOR.instances.get( 0 ) ).to.equal( editor2 );
-			} );
-		} );
-	} );
-
-	describe( 'elements param', () => {
-		const container = document.createElement( 'div' );
-		let el1, el2;
-
-		document.body.appendChild( container );
-
-		beforeEach( () => {
-			container.innerHTML = '';
-
-			el1 = document.createElement( 'div' );
-			el2 = document.createElement( 'div' );
-
-			container.appendChild( el1 );
-			container.appendChild( el2 );
-		} );
-
-		it( 'should work with a string', () => {
-			return CKEDITOR.create( 'div', editorConfig ).then( ( editor ) => {
-				assertElements( editor, document.querySelectorAll( 'div' ).length );
-			} );
-		} );
-
-		it( 'should work with an HTMLElement', () => {
-			return CKEDITOR.create( el1, editorConfig ).then( ( editor ) => {
-				assertElements( editor, 1 );
-			} );
-		} );
-
-		it( 'should work with a NodeList', () => {
-			const elements = container.querySelectorAll( 'div' );
-
-			return CKEDITOR.create( elements, editorConfig ).then( ( editor ) => {
-				assertElements( editor, 2 );
-			} );
-		} );
-
-		it( 'should work with an HTMLCollection', () => {
-			const elements = container.getElementsByTagName( 'div' );
-
-			return CKEDITOR.create( elements, editorConfig ).then( ( editor ) => {
-				assertElements( editor, 2 );
-			} );
-		} );
-
-		it( 'should work with an array', () => {
-			const elements = Array.from( container.getElementsByTagName( 'div' ) );
-
-			return CKEDITOR.create( elements, editorConfig ).then( ( editor ) => {
-				assertElements( editor, 2 );
-			} );
-		} );
-
-		it( 'should work with an object', () => {
-			const elements = {
-				editableA: el1,
-				editableB: el2
-			};
-
-			return CKEDITOR.create( elements, editorConfig ).then( ( editor ) => {
-				assertElements( editor, 2 );
-			} );
-		} );
-
-		it( 'should be rejected on element not found (when string passed)', () => {
-			let addSpy = testUtils.sinon.spy( CKEDITOR.instances, 'add' );
-
-			return CKEDITOR.create( '.undefined' )
-				.then( () => {
-					throw new Error( 'It should not enter this function.' );
-				} )
-				.catch( ( error ) => {
-					expect( error ).to.be.instanceof( CKEditorError );
-					expect( error.message ).to.match( /^ckeditor5-create-no-elements:/ );
-
-					// We need to make sure that create()'s execution is stopped.
-					// Assertion based on a real mistake we made that reject() wasn't followed by a return.
-					sinon.assert.notCalled( addSpy );
-				} );
-		} );
-
-		it( 'should be rejected on an empty elements array-like obj', () => {
-			return CKEDITOR.create( [] )
-				.then( () => {
-					throw new Error( 'It should not enter this function.' );
-				} )
-				.catch( ( error ) => {
-					expect( error ).to.be.instanceof( CKEditorError );
-					expect( error.message ).to.match( /^ckeditor5-create-no-elements:/ );
-				} );
-		} );
-
-		it( 'should be rejected on an empty object', () => {
-			return CKEDITOR.create( {} )
-				.then( () => {
-					throw new Error( 'It should not enter this function.' );
-				} )
-				.catch( ( error ) => {
-					expect( error ).to.be.instanceof( CKEditorError );
-					expect( error.message ).to.match( /^ckeditor5-create-no-elements:/ );
-				} );
-		} );
-
-		it( 'should take names from the ids or data-editable attributes', () => {
-			el1.id = 'foo';
-			el2.dataset.editable = 'bar';
-
-			return CKEDITOR.create( [ el1, el2 ], editorConfig )
-				.then( ( editor ) => {
-					expect( editor.elements.get( 'foo' ) ).to.equal( el1 );
-					expect( editor.elements.get( 'bar' ) ).to.equal( el2 );
-				} );
-		} );
-
-		it( 'should take names from the object keys', () => {
-			el1.id = 'foo';
-			el2.dataset.editable = 'bar';
-
-			return CKEDITOR.create( { a: el1, b: el2 }, editorConfig )
-				.then( ( editor ) => {
-					expect( editor.elements.get( 'a' ) ).to.equal( el1 );
-					expect( editor.elements.get( 'b' ) ).to.equal( el2 );
-				} );
-		} );
-
-		it( 'should generate editableN names', () => {
-			return CKEDITOR.create( [ el1, el2 ], editorConfig )
-				.then( ( editor ) => {
-					expect( Array.from( editor.elements.keys() ).join( ',' ) ).to.match( /^editable\d+,editable\d+$/ );
-				} );
-		} );
-
-		function assertElements( editor, expectedSize ) {
-			expect( editor.elements ).to.be.instanceof( Map );
-			expect( editor.elements ).to.have.property( 'size', expectedSize );
-		}
-	} );
-} );

+ 0 - 36
tests/creator/creator.js

@@ -1,36 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* bender-tags: creator */
-
-'use strict';
-
-import testUtils from '/tests/ckeditor5/_utils/utils.js';
-import Creator from '/ckeditor5/creator/creator.js';
-import Plugin from '/ckeditor5/plugin.js';
-import Editor from '/ckeditor5/editor.js';
-
-testUtils.createSinonSandbox();
-
-describe( 'Creator', () => {
-	let creator, editor;
-
-	beforeEach( () => {
-		editor = new Editor();
-		creator = new Creator( editor );
-	} );
-
-	describe( 'constructor', () => {
-		it( 'inherits from the Plugin', () => {
-			expect( creator ).to.be.instanceof( Plugin );
-		} );
-	} );
-
-	describe( 'create', () => {
-		it( 'returns a promise', () => {
-			expect( creator.create() ).to.be.instanceof( Promise );
-		} );
-	} );
-} );

+ 0 - 55
tests/creator/manual/_assets/styles.css

@@ -1,55 +0,0 @@
-.ck-body {
-	margin: 10px 0;
-	border: solid 3px red;
-}
-.ck-body::before {
-	content: '[[ ck-body region ]]';
-}
-
-.ck-box {
-	margin: 10px 0;
-}
-
-.ck-main {
-	border: solid 1px rgb( 200, 200, 200 );
-	padding: 5px
-}
-
-.ck-toolbar {
-	border: solid 1px rgb( 200, 200, 200 );
-	background: rgb( 240, 240, 240 );
-	padding: 5px;
-}
-
-.ck-toolbar.ck-hidden {
-	opacity: 0.3;
-}
-
-.ck-button {
-	border: solid 1px transparent;
-	background: transparent;
-	display: inline-block;
-	padding: 5px 10px;
-	border-radius: 1px;
-	margin-right: 5px;
-
-	font-size: 16px;
-	color: rgb( 69, 69, 69 );
-
-	cursor: pointer;
-}
-
-.ck-button:hover:not(.ck-disabled) {
-	border: solid 1px rgb( 180, 180, 180 );
-	box-shadow: 0 0 2px rgba( 0, 0, 0, 0.1 );
-}
-
-.ck-button.ck-on {
-	border: solid 1px rgb( 200, 200, 200 );
-	box-shadow: inset 0 0 3px rgba( 0, 0, 0, 0.1 );
-	background: rgba( 0, 0, 0, 0.05 );
-}
-
-.ck-button.ck-disabled {
-	color: rgb( 180, 180, 180 );
-}

+ 0 - 90
tests/creator/manual/_utils/creator/inlinecreator.js

@@ -1,90 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import StandardCreator from '/ckeditor5/creator/standardcreator.js';
-
-import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
-import Editable from '/ckeditor5/editable.js';
-
-import { createEditableUI, createEditorUI } from '/ckeditor5/ui/creator-utils.js';
-
-import EditorUIView from '/ckeditor5/ui/editorui/editoruiview.js';
-import BoxlessEditorUI from '/tests/ckeditor5/_utils/ui/boxlesseditorui/boxlesseditorui.js';
-import EditableUI from '/ckeditor5/ui/editableui/editableui.js';
-import InlineEditableUIView from '/ckeditor5/ui/editableui/inline/inlineeditableuiview.js';
-import Model from '/ckeditor5/ui/model.js';
-import FloatingToolbar from '/tests/ckeditor5/_utils/ui/floatingtoolbar/floatingtoolbar.js';
-import FloatingToolbarView from '/tests/ckeditor5/_utils/ui/floatingtoolbar/floatingtoolbarview.js';
-
-import { imitateFeatures, imitateDestroyFeatures } from '/ckeditor5/creator-classic/utils/imitatefeatures.js';
-
-export default class InlineCreator extends StandardCreator {
-	constructor( editor ) {
-		super( editor, new HtmlDataProcessor() );
-
-		this._createEditable();
-
-		createEditorUI( editor, BoxlessEditorUI, EditorUIView );
-	}
-
-	create() {
-		const editor = this.editor;
-		const editable = editor.editables.get( 0 );
-
-		// Features mock.
-		imitateFeatures( editor );
-
-		// UI.
-		this._createToolbars();
-		editor.ui.add( 'editable', createEditableUI( editor, editable, EditableUI, InlineEditableUIView ) );
-
-		// Init.
-		return super.create()
-			.then( () => editor.ui.init() )
-			// We'll be able to do that much earlier once the loading will be done to the document model,
-			// rather than straight to the editable.
-			.then( () => this.loadDataFromEditorElement() );
-	}
-
-	destroy() {
-		imitateDestroyFeatures();
-
-		this.updateEditorElement();
-
-		super.destroy();
-
-		return this.editor.ui.destroy();
-	}
-
-	_createEditable() {
-		const editor = this.editor;
-		const editorElement = editor.firstElement;
-		const editableName = editor.firstElementName;
-		const editable = new Editable( editor, editableName );
-
-		editor.editables.add( editable );
-		editable.bindTo( editorElement );
-		editor.document.createRoot( editableName, '$root' );
-	}
-
-	_createToolbars() {
-		const editableName = this.editor.firstElementName;
-		const locale = this.editor.locale;
-
-		const toolbar1Model = new Model( null, { editableName } );
-		const toolbar2Model = new Model( null, { editableName } );
-
-		const toolbar1 = new FloatingToolbar( toolbar1Model, new FloatingToolbarView( toolbar1Model, locale ), this.editor );
-		const toolbar2 = new FloatingToolbar( toolbar2Model, new FloatingToolbarView( toolbar2Model, locale ), this.editor );
-
-		toolbar1.addButtons( this.editor.config.toolbar );
-		toolbar2.addButtons( this.editor.config.toolbar.reverse() );
-
-		this.editor.ui.add( 'body', toolbar1 );
-		this.editor.ui.add( 'body', toolbar2 );
-	}
-}

+ 0 - 76
tests/creator/manual/_utils/creator/legacycreator.js

@@ -1,76 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import StandardCreator from '/ckeditor5/creator/standardcreator.js';
-
-import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
-import Editable from '/ckeditor5/editable.js';
-
-import { createEditableUI, createEditorUI } from '/ckeditor5/ui/creator-utils.js';
-
-import BoxedEditorUI from '/ckeditor5/ui/editorui/boxed/boxededitorui.js';
-import BoxedEditorUIView from '/ckeditor5/ui/editorui/boxed/boxededitoruiview.js';
-import FramedEditableUIIframe from '/tests/ckeditor5/_utils/ui/editableui/framed/framededitableuiiframe.js';
-import FramedEditableUIIframeView from '/tests/ckeditor5/_utils/ui/editableui/framed/framededitableuiiframeview.js';
-import Model from '/ckeditor5/ui/model.js';
-import Toolbar from '/ckeditor5/ui/bindings/toolbar.js';
-import ToolbarView from '/ckeditor5/ui/toolbar/toolbarview.js';
-
-import { imitateFeatures, imitateDestroyFeatures } from '/ckeditor5/creator-classic/utils/imitatefeatures.js';
-
-export default class LegacyCreator extends StandardCreator {
-	constructor( editor ) {
-		super( editor, new HtmlDataProcessor() );
-
-		const editableName = editor.firstElementName;
-		editor.editables.add( new Editable( editor, editableName ) );
-		editor.document.createRoot( editableName, '$root' );
-
-		// UI.
-		createEditorUI( editor, BoxedEditorUI, BoxedEditorUIView );
-	}
-
-	create() {
-		const editor = this.editor;
-		const editable = editor.editables.get( 0 );
-
-		// Features mock.
-		imitateFeatures( editor );
-
-		// UI.
-		this._replaceElement( editor.firstElement, editor.ui.view.element );
-		this._createToolbar();
-		editor.ui.add( 'main', createEditableUI( editor, editable, FramedEditableUIIframe, FramedEditableUIIframeView ) );
-
-		// Init.
-		return super.create()
-			.then( () => editor.ui.init() )
-			// We'll be able to do that much earlier once the loading will be done to the document model,
-			// rather than straight to the editable.
-			.then( () => this.loadDataFromEditorElement() );
-	}
-
-	destroy() {
-		imitateDestroyFeatures();
-
-		this.updateEditorElement();
-
-		super.destroy();
-
-		return this.editor.ui.destroy();
-	}
-
-	_createToolbar() {
-		const editor = this.editor;
-		const toolbarModel = new Model();
-		const toolbar = new Toolbar( toolbarModel, new ToolbarView( toolbarModel, editor.locale ), editor );
-
-		toolbar.addButtons( editor.config.toolbar );
-
-		this.editor.ui.add( 'top', toolbar );
-	}
-}

+ 0 - 91
tests/creator/manual/_utils/creator/multicreator.js

@@ -1,91 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-import StandardCreator from '/ckeditor5/creator/standardcreator.js';
-
-import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
-import Editable from '/ckeditor5/editable.js';
-
-import { createEditableUI, createEditorUI } from '/ckeditor5/ui/creator-utils.js';
-
-import BoxedEditorUI from '/ckeditor5/ui/editorui/boxed/boxededitorui.js';
-import BoxedEditorUIView from '/ckeditor5/ui/editorui/boxed/boxededitoruiview.js';
-import EditableUI from '/ckeditor5/ui/editableui/editableui.js';
-import InlineEditableUIView from '/ckeditor5/ui/editableui/inline/inlineeditableuiview.js';
-import Model from '/ckeditor5/ui/model.js';
-import Toolbar from '/ckeditor5/ui/bindings/toolbar.js';
-import ToolbarView from '/ckeditor5/ui/toolbar/toolbarview.js';
-
-import { imitateFeatures, imitateDestroyFeatures } from '/ckeditor5/creator-classic/utils/imitatefeatures.js';
-
-export default class MultiCreator extends StandardCreator {
-	constructor( editor ) {
-		super( editor, new HtmlDataProcessor() );
-
-		// Engine.
-		this._createEditables();
-
-		// UI.
-		createEditorUI( editor, BoxedEditorUI, BoxedEditorUIView );
-	}
-
-	create() {
-		const editor = this.editor;
-
-		// Features mock.
-		imitateFeatures( editor );
-
-		// UI.
-		this._createToolbar();
-
-		for ( let editable of editor.editables ) {
-			editor.ui.add( 'main', createEditableUI( editor, editable, EditableUI, InlineEditableUIView ) );
-		}
-
-		editor.elements.forEach( ( element ) => {
-			this._replaceElement( element, null );
-		} );
-
-		// Init.
-		return super.create()
-			.then( () => editor.ui.init() )
-			// We'll be able to do that much earlier once the loading will be done to the document model,
-			// rather than straight to the editable.
-			.then( () => this.loadDataFromEditorElements() );
-	}
-
-	destroy() {
-		imitateDestroyFeatures();
-
-		this.updateEditorElements();
-
-		super.destroy();
-
-		this.editor.ui.destroy();
-	}
-
-	_createEditables() {
-		const editor = this.editor;
-
-		editor.elements.forEach( ( editorElement, editableName ) => {
-			const editable = new Editable( editor, editableName );
-
-			editor.editables.add( editable );
-			editor.document.createRoot( editableName, '$root' );
-		} );
-	}
-
-	_createToolbar() {
-		const editor = this.editor;
-		const toolbarModel = new Model();
-		const toolbar = new Toolbar( toolbarModel, new ToolbarView( toolbarModel, editor.locale ), editor );
-
-		toolbar.addButtons( editor.config.toolbar );
-
-		this.editor.ui.add( 'top', toolbar );
-	}
-}

+ 0 - 13
tests/creator/manual/creator-inline.html

@@ -1,13 +0,0 @@
-<head>
-	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/amd/theme/ckeditor.css">
-</head>
-
-<p>
-	<button id="destroyEditor">Destroy editor</button>
-	<button id="initEditor">Init editor</button>
-</p>
-
-<div id="editor">
-	<h1>Hello world!</h1>
-	<p>This is an editor instance.</p>
-</div>

+ 0 - 47
tests/creator/manual/creator-inline.js

@@ -1,47 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* global console:false */
-
-'use strict';
-
-import CKEDITOR from '/ckeditor.js';
-import InlineCreator from '/tests/ckeditor5/creator/manual/_utils/creator/inlinecreator.js';
-import testUtils from '/tests/utils/_utils/utils.js';
-
-let editor, editable, observer;
-
-function initEditor() {
-	CKEDITOR.create( '#editor', {
-		creator: InlineCreator,
-		toolbar: [ 'bold', 'italic' ]
-	} )
-	.then( ( newEditor ) => {
-		console.log( 'Editor was initialized', newEditor );
-		console.log( 'You can now play with it using global `editor` and `editable` variable.' );
-
-		window.editor = editor = newEditor;
-		window.editable = editable = editor.editables.get( 0 );
-
-		observer = testUtils.createObserver();
-		observer.observe( 'Editable', editable );
-	} );
-}
-
-function destroyEditor() {
-	editor.destroy()
-		.then( () => {
-			window.editor = editor = null;
-			window.editable = editable = null;
-
-			observer.stopListening();
-			observer = null;
-
-			console.log( 'Editor was destroyed' );
-		} );
-}
-
-document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
-document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );

+ 0 - 21
tests/creator/manual/creator-inline.md

@@ -1,21 +0,0 @@
-@bender-ui: collapsed
-
-1. Click "Init editor".
-2. Expected:
-  * Inline editor should be created.
-  * There should be **two** toolbars:
-    * one with "Bold" and "Italic" buttons,
-    * second with "Italic" and "Bold" buttons.
-3. Click "Destroy editor".
-4. Expected:
-  * Editor should be destroyed (the element should not be editable).
-  * The element should contain its data (updated).
-  * The 'ck-body region' should be removed.
-
-## Notes:
-
-* You can play with:
-  * `editable.isEditable`,
-  * `boldModel.isEnabled` and `italicModel.isEnabled`.
-* Changes to `editable.isFocused/isEditable` should be logged to the console.
-* Buttons' states should be synchronised between toolbars (they share models).

+ 0 - 13
tests/creator/manual/creator-legacy.html

@@ -1,13 +0,0 @@
-<head>
-	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/amd/theme/ckeditor.css">
-</head>
-
-<p>
-	<button id="destroyEditor">Destroy editor</button>
-	<button id="initEditor">Init editor</button>
-</p>
-
-<div id="editor">
-	<h1>Hello world!</h1>
-	<p>This is an editor instance.</p>
-</div>

+ 0 - 51
tests/creator/manual/creator-legacy.js

@@ -1,51 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* global console:false */
-
-'use strict';
-
-import CKEDITOR from '/ckeditor.js';
-import LegacyCreator from '/tests/ckeditor5/creator/manual/_utils/creator/legacycreator.js';
-import testUtils from '/tests/utils/_utils/utils.js';
-
-let editor, editable, observer;
-
-function initEditor() {
-	CKEDITOR.create( '#editor', {
-		creator: LegacyCreator,
-		ui: {
-			width: 400,
-			height: 400
-		},
-		toolbar: [ 'bold', 'italic' ]
-	} )
-	.then( ( newEditor ) => {
-		console.log( 'Editor was initialized', newEditor );
-		console.log( 'You can now play with it using global `editor` and `editable` variables.' );
-
-		window.editor = editor = newEditor;
-		window.editable = editable = editor.editables.get( 0 );
-
-		observer = testUtils.createObserver();
-		observer.observe( 'Editable', editable );
-	} );
-}
-
-function destroyEditor() {
-	editor.destroy()
-		.then( () => {
-			window.editor = editor = null;
-			window.editable = editable = null;
-
-			observer.stopListening();
-			observer = null;
-
-			console.log( 'Editor was destroyed' );
-		} );
-}
-
-document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
-document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );

+ 0 - 23
tests/creator/manual/creator-legacy.md

@@ -1,23 +0,0 @@
-@bender-ui: collapsed
-
-1. Click "Init editor".
-2. Expected:
-  * Framed editor should be created.
-  * It should be rectangular (400x400).
-  * Original element should disappear.
-  * There should be a toolbar with "Bold" and "Italic" buttons.
-3. Click "Destroy editor".
-4. Expected:
-  * Editor should be destroyed.
-  * Original element should be visible.
-  * The element should contain its data (updated).
-  * The 'ck-body region' should be removed.
-
-## Notes:
-
-* You can play with:
-  * `editable.isEditable`,
-  * `editor.ui.width/height`.
-  * `boldModel.isEnabled` and `italicModel.isEnabled`.
-* Changes to `editable.isFocused/isEditable` should be logged to the console.
-* Clicks on the buttons should be logged to the console.

+ 0 - 20
tests/creator/manual/creator-multi.html

@@ -1,20 +0,0 @@
-<head>
-	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/amd/theme/ckeditor.css">
-</head>
-
-<p>
-	<button id="destroyEditor">Destroy editor</button>
-	<button id="initEditor">Init editor</button>
-</p>
-
-<div id="editorContainer"></div>
-
-<div id="editable1" class="editor">
-	<h1>Hello world!</h1>
-	<p>This is an editor instance.</p>
-</div>
-
-<div id="editable2" class="editor">
-	<h1>Hello again!</h1>
-	<p>This is the same editor instance.</p>
-</div>

+ 0 - 60
tests/creator/manual/creator-multi.js

@@ -1,60 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* global console:false */
-
-'use strict';
-
-import CKEDITOR from '/ckeditor.js';
-import MultiCreator from '/tests/ckeditor5/creator/manual/_utils/creator/multicreator.js';
-import testUtils from '/tests/utils/_utils/utils.js';
-
-let editor, editables, observer;
-
-function initEditor() {
-	CKEDITOR.create( '.editor', {
-		creator: MultiCreator,
-		toolbar: [ 'bold', 'italic' ]
-	} )
-	.then( ( newEditor ) => {
-		console.log( 'Editor was initialized', newEditor );
-		console.log( 'You can now play with it using global `editor` and `editables` variables.' );
-
-		window.editor = editor = newEditor;
-		window.editables = editables = editor.editables;
-
-		const editable1 = editables.get( 'editable1' );
-		const editable2 = editables.get( 'editable2' );
-
-		editable1.toString = editable2.toString = function() {
-			return `Editable(${ this.name })`;
-		};
-
-		observer = testUtils.createObserver();
-		observer.observe( 'Editable 1', editable1 );
-		observer.observe( 'Editable 2', editable2 );
-		observer.observe( 'EditableCollection', editables );
-
-		document.getElementById( 'editorContainer' ).appendChild( editor.ui.view.element );
-	} );
-}
-
-function destroyEditor() {
-	editor.destroy()
-		.then( () => {
-			window.editor = editor = null;
-			window.editables = editables = null;
-
-			observer.stopListening();
-			observer = null;
-
-			document.getElementById( 'editorContainer' ).innerHTML = '';
-
-			console.log( 'Editor was destroyed' );
-		} );
-}
-
-document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
-document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );

+ 0 - 22
tests/creator/manual/creator-multi.md

@@ -1,22 +0,0 @@
-@bender-ui: collapsed
-
-1. Click "Init editor".
-2. Expected:
-  * Boxed editor with two editables should be created.
-  * Original elements should disappear.
-  * There should be a toolbar with "Bold" and "Italic" buttons.
-3. Click "Destroy editor".
-4. Expected:
-  * Editor should be destroyed.
-  * Original elements should be visible.
-  * The elements should contain their data (updated).
-  * The 'ck-body region' should be removed.
-
-## Notes:
-
-* You can play with:
-  * `editables.get( 'editable1/2' ).isEditable`,
-  * `boldModel.isEnabled` and `italicModel.isEnabled`.
-* Changes to `editable.isFocused/isEditable` should be logged to the console.
-* Changes to `editables.current` should be logged to the console.
-* Clicks on the buttons should be logged to the console.

+ 0 - 3
tests/creator/standardcreator.html

@@ -1,3 +0,0 @@
-<textarea id="getData-textarea">&lt;b&gt;foo&lt;/b&gt;</textarea>
-<div id="getData-div"><b>foo</b></div>
-<template id="getData-template"><b>foo</b></template>

+ 0 - 239
tests/creator/standardcreator.js

@@ -1,239 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* bender-tags: creator, browser-only */
-
-'use strict';
-
-import testUtils from '/tests/ckeditor5/_utils/utils.js';
-import Creator from '/ckeditor5/creator/creator.js';
-import StandardCreator from '/ckeditor5/creator/standardcreator.js';
-import Editor from '/ckeditor5/editor.js';
-import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
-import Document from '/ckeditor5/engine/model/document.js';
-import EditingController from '/ckeditor5/engine/editingcontroller.js';
-import DataController from '/ckeditor5/engine/datacontroller.js';
-import KeystrokeHandler from '/ckeditor5/keystrokehandler.js';
-
-testUtils.createSinonSandbox();
-
-describe( 'Creator', () => {
-	let creator, editor;
-
-	beforeEach( () => {
-		const firstElement = document.createElement( 'div' );
-		document.body.appendChild( firstElement );
-
-		const secondElement = document.createElement( 'div' );
-		document.body.appendChild( secondElement );
-
-		editor = new Editor( { first: firstElement, second: secondElement } );
-		creator = new StandardCreator( editor, new HtmlDataProcessor() );
-	} );
-
-	describe( 'constructor', () => {
-		it( 'inherits from the Creator', () => {
-			expect( creator ).to.be.instanceof( Creator );
-		} );
-
-		it( 'creates the engine', () => {
-			expect( editor.document ).to.be.instanceof( Document );
-			expect( editor.editing ).to.be.instanceof( EditingController );
-			expect( editor.data ).to.be.instanceof( DataController );
-			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
-		} );
-
-		it( 'creates the keystroke handler', () => {
-			expect( editor.keystrokes ).to.be.instanceof( KeystrokeHandler );
-		} );
-
-		it( 'uses HtmlDataProcessor if no processor is provided in constructor', () => {
-			creator = new StandardCreator( editor );
-
-			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
-		} );
-	} );
-
-	describe( 'create', () => {
-		it( 'returns a promise', () => {
-			expect( creator.create() ).to.be.instanceof( Promise );
-		} );
-	} );
-
-	describe( 'destroy', () => {
-		it( 'calls super.destroy', () => {
-			const creatorSpy = testUtils.sinon.spy( Creator.prototype, 'destroy' );
-
-			creator.destroy();
-
-			expect( creatorSpy.called ).to.be.true;
-		} );
-
-		it( 'should destroy the engine', () => {
-			const spy = editor.document.destroy = editor.data.destroy = editor.editing.destroy = sinon.spy();
-
-			creator.destroy();
-
-			expect( spy.callCount ).to.equal( 3 );
-		} );
-
-		it( 'should restore the replaced element', () => {
-			const spy = testUtils.sinon.stub( creator, '_restoreElements' );
-
-			creator.destroy();
-
-			expect( spy.calledOnce ).to.be.true;
-		} );
-	} );
-
-	describe( 'updateEditorElement', () => {
-		it( 'should pass data to the first element when element name not specified', () => {
-			editor.getData = ( rootName ) => {
-				expect( rootName ).to.equal( 'first' );
-
-				return 'foo';
-			};
-
-			creator.updateEditorElement();
-
-			expect( editor.firstElement.innerHTML ).to.equal( 'foo' );
-		} );
-
-		it( 'should pass data to the given element', () => {
-			editor.elements.set( 'second', document.createElement( 'div' ) );
-
-			editor.getData = ( rootName ) => {
-				expect( rootName ).to.equal( 'second' );
-
-				return 'foo';
-			};
-
-			creator.updateEditorElement( 'second' );
-
-			expect( editor.elements.get( 'second' ).innerHTML ).to.equal( 'foo' );
-		} );
-	} );
-
-	describe( 'updateEditorElements', () => {
-		it( 'updates all editor elements', () => {
-			const spy = sinon.stub( creator, 'updateEditorElement' );
-
-			creator.updateEditorElements();
-
-			expect( spy.calledTwice ).to.be.true;
-			expect( spy.calledWith( 'first' ) ).to.be.true;
-			expect( spy.calledWith( 'second' ) ).to.be.true;
-		} );
-	} );
-
-	describe( 'loadDataFromEditorElement', () => {
-		it( 'should pass data to the first element', () => {
-			editor.setData = sinon.spy();
-
-			editor.elements.get( 'first' ).innerHTML = 'foo';
-			creator.loadDataFromEditorElement();
-
-			expect( editor.setData.calledWithExactly( 'foo', 'first' ) ).to.be.true;
-		} );
-
-		it( 'should pass data to the given element', () => {
-			const element = document.createElement( 'div' );
-			element.innerHTML = 'foo';
-
-			editor.elements.set( 'second', element );
-
-			editor.setData = sinon.spy();
-
-			creator.loadDataFromEditorElement( 'second' );
-
-			expect( editor.setData.calledWithExactly( 'foo', 'second' ) ).to.be.true;
-		} );
-	} );
-
-	describe( 'loadDataFromEditorElements', () => {
-		it( 'updates all editor elements', () => {
-			const spy = sinon.stub( creator, 'loadDataFromEditorElement' );
-
-			creator.loadDataFromEditorElements();
-
-			expect( spy.calledTwice ).to.be.true;
-			expect( spy.calledWith( 'first' ) ).to.be.true;
-			expect( spy.calledWith( 'second' ) ).to.be.true;
-		} );
-	} );
-
-	describe( 'getDataFromElement', () => {
-		[ 'textarea', 'template', 'div' ].forEach( ( elementName ) => {
-			it( 'should return the content of a ' + elementName, function() {
-				const data = StandardCreator.getDataFromElement( document.getElementById( 'getData-' + elementName ) );
-				expect( data ).to.equal( '<b>foo</b>' );
-			} );
-		} );
-	} );
-
-	describe( 'setDataInElement', () => {
-		[ 'textarea', 'template', 'div' ].forEach( ( elementName ) => {
-			it( 'should set the content of a ' + elementName, () => {
-				const el = document.createElement( elementName );
-				const expectedData = '<b>foo</b>';
-
-				StandardCreator.setDataInElement( el, expectedData );
-
-				const actualData = StandardCreator.getDataFromElement( el );
-				expect( actualData ).to.equal( actualData );
-			} );
-		} );
-	} );
-
-	describe( '_replaceElement', () => {
-		it( 'should hide the element', () => {
-			const el = editor.elements.get( 'first' );
-
-			creator._replaceElement( el );
-
-			expect( el.style.display ).to.equal( 'none' );
-		} );
-
-		it( 'should inserts the replacement next to the element being hidden', () => {
-			const el = editor.elements.get( 'first' );
-			const replacement = document.createElement( 'div' );
-
-			creator._replaceElement( el, replacement );
-
-			expect( el.nextSibling ).to.equal( replacement );
-		} );
-	} );
-
-	describe( '_restoreElements', () => {
-		it( 'should restore all elements', () => {
-			const el1 = editor.elements.get( 'first' );
-			const replacement1 = document.createElement( 'div' );
-			const el2 = editor.elements.get( 'second' );
-			const replacement2 = document.createElement( 'div' );
-
-			creator._replaceElement( el1, replacement1 );
-			creator._replaceElement( el2, replacement2 );
-
-			creator._restoreElements();
-
-			expect( replacement1.parentNode ).to.be.null;
-			expect( replacement2.parentNode ).to.be.null;
-			expect( el2.style.display ).to.not.equal( 'none' );
-		} );
-
-		it( 'should not try to remove replacement elements', () => {
-			const el1 = editor.elements.get( 'first' );
-			const el2 = editor.elements.get( 'second' );
-
-			creator._replaceElement( el1 );
-			creator._replaceElement( el2 );
-
-			creator._restoreElements();
-
-			expect( el1.style.display ).to.not.equal( 'none' );
-			expect( el2.style.display ).to.not.equal( 'none' );
-		} );
-	} );
-} );