From 388b21b9ad0cda26252927da3ecb477fcfabbb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksander=20Nowodzi=C5=84ski?= Date: Fri, 4 Nov 2016 15:46:23 +0100 Subject: [PATCH] Post-rebase fixes. --- tests/balloonpanel/balloonpanel.js | 42 ---------- tests/bindings/stickytoolbar.js | 52 ------------ tests/bindings/toolbar.js | 52 ------------ tests/bindings/toolbarbindingsmixin.js | 68 --------------- tests/button/button.js | 106 ------------------------ tests/dropdown/dropdown.js | 88 -------------------- tests/dropdown/dropdownbuttonview.js | 22 ----- tests/dropdown/dropdownpanel.js | 32 ------- tests/dropdown/list/listdropdown.js | 66 --------------- tests/dropdown/list/listdropdownview.js | 87 ------------------- tests/editableui/editableui.js | 57 ------------- tests/editorui/boxed/boxededitorui.js | 34 -------- tests/editorui/editorui.js | 51 ------------ tests/icon/icon.js | 29 ------- tests/iconmanager/iconmanager.js | 30 ------- tests/inputtext/inputtext.js | 39 --------- tests/label/label.js | 31 ------- tests/labeledinput/labeledinput.js | 90 -------------------- tests/list/list.js | 94 --------------------- tests/list/listitem.js | 49 ----------- tests/toolbar/sticky/stickytoolbar.js | 34 -------- tests/toolbar/toolbar.js | 31 ------- 22 files changed, 1184 deletions(-) delete mode 100644 tests/balloonpanel/balloonpanel.js delete mode 100644 tests/bindings/stickytoolbar.js delete mode 100644 tests/bindings/toolbar.js delete mode 100644 tests/bindings/toolbarbindingsmixin.js delete mode 100644 tests/button/button.js delete mode 100644 tests/dropdown/dropdown.js delete mode 100644 tests/dropdown/dropdownbuttonview.js delete mode 100644 tests/dropdown/dropdownpanel.js delete mode 100644 tests/dropdown/list/listdropdown.js delete mode 100644 tests/dropdown/list/listdropdownview.js delete mode 100644 tests/editableui/editableui.js delete mode 100644 tests/editorui/boxed/boxededitorui.js delete mode 100644 tests/editorui/editorui.js delete mode 100644 tests/icon/icon.js delete mode 100644 tests/iconmanager/iconmanager.js delete mode 100644 tests/inputtext/inputtext.js delete mode 100644 tests/label/label.js delete mode 100644 tests/labeledinput/labeledinput.js delete mode 100644 tests/list/list.js delete mode 100644 tests/list/listitem.js delete mode 100644 tests/toolbar/sticky/stickytoolbar.js delete mode 100644 tests/toolbar/toolbar.js diff --git a/tests/balloonpanel/balloonpanel.js b/tests/balloonpanel/balloonpanel.js deleted file mode 100644 index 611a14d..0000000 --- a/tests/balloonpanel/balloonpanel.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, balloonPanel */ - -import BalloonPanel from 'ckeditor5/ui/balloonpanel/balloonpanel.js'; -import BalloonPanelView from 'ckeditor5/ui/balloonpanel/balloonpanelview.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'BalloonPanel', () => { - let model, balloonPanel, view; - - beforeEach( () => { - model = new Model( { - maxWidth: 200 - } ); - - view = new BalloonPanelView(); - balloonPanel = new BalloonPanel( model, view ); - - return balloonPanel.init(); - } ); - - describe( 'constructor()', () => { - it( 'should bind view attributes to the BalloonPanel#model', () => { - expect( view.maxWidth ).to.equal( model.maxWidth ).to.equal( 200 ); - } ); - - it( 'should set default values to view', () => { - expect( view.top ).to.equal( 0 ); - expect( view.left ).to.equal( 0 ); - expect( view.arrow ).to.equal( 'se' ); - expect( view.isVisible ).to.equal( false ); - } ); - - it( 'should create an empty content collection', () => { - expect( balloonPanel.collections.get( 'content' ) ).to.have.length( 0 ); - } ); - } ); -} ); diff --git a/tests/bindings/stickytoolbar.js b/tests/bindings/stickytoolbar.js deleted file mode 100644 index 2c486ca..0000000 --- a/tests/bindings/stickytoolbar.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, bindings, toolbar */ - -import Editor from 'ckeditor5/core/editor/editor.js'; -import Model from 'ckeditor5/ui/model.js'; -import View from 'ckeditor5/ui/view.js'; -import Controller from 'ckeditor5/ui/controller.js'; -import StickyToolbar from 'ckeditor5/ui/bindings/stickytoolbar.js'; - -import testUtils from 'tests/core/_utils/utils.js'; -testUtils.createSinonSandbox(); - -describe( 'StickyToolbar', () => { - let toolbar, model; - - const editor = new Editor(); - - editor.ui = { - featureComponents: { - create: () => new Controller() - } - }; - - beforeEach( () => { - model = new Model( { - isActive: false, - config: [ 'bold', 'italic' ] - } ); - - toolbar = new StickyToolbar( model, new View(), editor ); - } ); - - describe( 'constructor()', () => { - it( 'sets all the properties', () => { - expect( toolbar ).to.have.property( 'editor', editor ); - } ); - } ); - - describe( 'init', () => { - it( 'calls bindToolbarItems', () => { - const spy = testUtils.sinon.spy( toolbar, 'bindToolbarItems' ); - - return toolbar.init().then( () => { - expect( spy.calledOnce ).to.be.true; - } ); - } ); - } ); -} ); diff --git a/tests/bindings/toolbar.js b/tests/bindings/toolbar.js deleted file mode 100644 index 0a1e939..0000000 --- a/tests/bindings/toolbar.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, bindings, toolbar */ - -import Editor from 'ckeditor5/core/editor/editor.js'; -import Model from 'ckeditor5/ui/model.js'; -import View from 'ckeditor5/ui/view.js'; -import Controller from 'ckeditor5/ui/controller.js'; -import Toolbar from 'ckeditor5/ui/bindings/toolbar.js'; - -import testUtils from 'tests/core/_utils/utils.js'; -testUtils.createSinonSandbox(); - -describe( 'Toolbar', () => { - let toolbar, model; - - const editor = new Editor(); - - editor.ui = { - featureComponents: { - create: () => new Controller() - } - }; - - beforeEach( () => { - model = new Model( { - isActive: false, - config: [ 'bold', 'italic' ] - } ); - - toolbar = new Toolbar( model, new View(), editor ); - } ); - - describe( 'constructor()', () => { - it( 'sets all the properties', () => { - expect( toolbar ).to.have.property( 'editor', editor ); - } ); - } ); - - describe( 'init', () => { - it( 'calls bindToolbarItems', () => { - const spy = testUtils.sinon.spy( toolbar, 'bindToolbarItems' ); - - return toolbar.init().then( () => { - expect( spy.calledOnce ).to.be.true; - } ); - } ); - } ); -} ); diff --git a/tests/bindings/toolbarbindingsmixin.js b/tests/bindings/toolbarbindingsmixin.js deleted file mode 100644 index fe36390..0000000 --- a/tests/bindings/toolbarbindingsmixin.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, bindings, toolbar */ - -import mix from 'ckeditor5/utils/mix.js'; -import Editor from 'ckeditor5/core/editor/editor.js'; -import Collection from 'ckeditor5/utils/collection.js'; -import Model from 'ckeditor5/ui/model.js'; -import Controller from 'ckeditor5/ui/controller.js'; -import ToolbarBindingsMixin from 'ckeditor5/ui/bindings/toolbarbindingsmixin.js'; - -describe( 'ToolbarBindingsMixin', () => { - const editor = new Editor(); - let mixinInstance; - - editor.ui = { - featureComponents: { - create: () => new Controller() - } - }; - - class MixClass extends Controller { - constructor( model, view ) { - super( model, view ); - - this.editor = editor; - this.addCollection( 'items' ); - } - } - - mix( MixClass, ToolbarBindingsMixin ); - - beforeEach( () => { - mixinInstance = new MixClass( new Model( { - config: [ 'bold', 'italic' ] - } ) ); - } ); - - describe( 'bindToolbarItems', () => { - it( 'creates item collection', () => { - mixinInstance.bindToolbarItems(); - - expect( mixinInstance.items ).to.be.instanceOf( Collection ); - expect( mixinInstance.items.map( i => i.name ) ).to.have.members( [ 'bold', 'italic' ] ); - } ); - - it( 'works when no config specified in the model', () => { - mixinInstance = new MixClass( new Model( {} ) ); - mixinInstance.bindToolbarItems(); - - expect( mixinInstance.items ).to.be.instanceOf( Collection ); - expect( mixinInstance.items ).to.have.length( 0 ); - } ); - - it( 'binds item collection to "items" controller collection', () => { - const items = mixinInstance.collections.get( 'items' ); - - expect( items ).to.have.length( 0 ); - - mixinInstance.bindToolbarItems(); - - expect( items ).to.have.length( 2 ); - } ); - } ); -} ); diff --git a/tests/button/button.js b/tests/button/button.js deleted file mode 100644 index ec62c23..0000000 --- a/tests/button/button.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, button */ - -import Button from 'ckeditor5/ui/button/button.js'; -import ButtonView from 'ckeditor5/ui/button/buttonview.js'; -import Model from 'ckeditor5/ui/model.js'; - -import testUtils from 'tests/core/_utils/utils.js'; -import Controller from 'ckeditor5/ui/controller.js'; - -testUtils.createSinonSandbox(); - -describe( 'Button', () => { - let model, button, view; - - beforeEach( () => { - model = new Model( { - label: 'foo', - isOn: false, - isEnabled: false, - keystroke: 'ALT+F' - } ); - - view = new ButtonView(); - button = new Button( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'binds view attributes to the Button#model', () => { - expect( view.label ).to.equal( model.label ); - expect( view.isOn ).to.equal( model.isOn ); - expect( view.isEnabled ).to.equal( model.isEnabled ); - expect( view.title ).to.equal( `${ model.label } (${ model.keystroke })` ); - - expect( view.type ).to.be.undefined; - expect( view.withText ).to.be.undefined; - expect( view.icon ).to.be.undefined; - } ); - - it( 'binds view#title to Button.model#label and Button.model#keystroke', () => { - model.label = 'ABC'; - model.keystroke = ''; - expect( view.title ).to.equal( 'ABC' ); - - model.keystroke = 'FOO'; - expect( view.title ).to.equal( `ABC (FOO)` ); - - model.label = 'XYZ'; - expect( view.title ).to.equal( `XYZ (FOO)` ); - } ); - - it( 'binds view icon–related attributes to the Button#model', () => { - model.set( { - icon: 'abc' - } ); - - view = new ButtonView(); - button = new Button( model, view ); - - expect( view.icon ).to.equal( model.icon ); - } ); - - it( 'creates view#click -> model#execute binding', () => { - const spy = sinon.spy(); - - model.on( 'execute', spy ); - - view.fire( 'click' ); - - expect( spy.calledOnce ).to.be.true; - } ); - } ); - - describe( 'init', () => { - it( 'does not append child Icon instance by default', () => { - return button.init().then( () => { - expect( view.element.childNodes ).to.have.length( 1 ); - } ); - } ); - - it( 'appends child Icon instance when Button.model#icon is present', () => { - model.set( { - icon: 'foo' - } ); - - view = new ButtonView(); - - return new Button( model, view ).init().then( () => { - expect( view.element.childNodes ).to.have.length( 2 ); - expect( view.element.firstChild.classList.contains( 'ck-icon' ) ).to.be.true; - } ); - } ); - - it( 'calls Controller#init()', () => { - const spy = testUtils.sinon.spy( Controller.prototype, 'init' ); - - return button.init().then( () => { - expect( spy.calledOnce ).to.be.true; - } ); - } ); - } ); -} ); diff --git a/tests/dropdown/dropdown.js b/tests/dropdown/dropdown.js deleted file mode 100644 index 049362a..0000000 --- a/tests/dropdown/dropdown.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, dropdown */ - -import Model from 'ckeditor5/ui/model.js'; - -import Dropdown from 'ckeditor5/ui/dropdown/dropdown.js'; -import DropdownView from 'ckeditor5/ui/dropdown/dropdownview.js'; - -import Button from 'ckeditor5/ui/button/button.js'; -import DropdownButtonView from 'ckeditor5/ui/dropdown/dropdownbuttonview.js'; - -import DropdownPanel from 'ckeditor5/ui/dropdown/dropdownpanel.js'; -import DropdownPanelView from 'ckeditor5/ui/dropdown/dropdownpanelview.js'; - -import utilsTestUtils from 'tests/utils/_utils/utils.js'; - -const assertBinding = utilsTestUtils.assertBinding; - -describe( 'Dropdown', () => { - let model, dropdown; - - beforeEach( () => { - model = new Model( { - isEnabled: true, - label: 'foo', - isOn: false, - withText: true - } ); - dropdown = new Dropdown( model, new DropdownView() ); - } ); - - describe( 'constructor()', () => { - it( 'appends button and panel to dropdown collection', () => { - expect( dropdown.collections.get( 'main' ) ).to.have.length( 2 ); - expect( dropdown.collections.get( 'main' ).get( 0 ) ).to.equal( dropdown.button ); - expect( dropdown.collections.get( 'main' ).get( 1 ) ).to.equal( dropdown.panel ); - } ); - } ); - - describe( '_createButton', () => { - it( 'creates Button component', () => { - expect( dropdown.button ).to.be.instanceof( Button ); - expect( dropdown.button.view ).to.be.instanceof( DropdownButtonView ); - } ); - - it( 'binds Button#model to the #model', () => { - assertBinding( dropdown.button.model, - { isEnabled: true, label: 'foo', isOn: false, withText: true }, - [ - [ model, { isEnabled: false, label: 'bar', isOn: true, withText: false } ] - ], - { isEnabled: false, label: 'bar', isOn: true, withText: false } - ); - } ); - - it( 'creates a listener which updates view#isOpen when button fires #execute', () => { - const buttonModel = dropdown.button.model; - const viewModel = dropdown.view; - - buttonModel.fire( 'execute' ); - expect( viewModel.isOpen ).to.be.true; - - buttonModel.fire( 'execute' ); - expect( viewModel.isOpen ).to.be.false; - } ); - } ); - - describe( '_createPanel', () => { - it( 'creates DropdownPanel component', () => { - expect( dropdown.panel ).to.be.instanceof( DropdownPanel ); - expect( dropdown.panel.view ).to.be.instanceof( DropdownPanelView ); - } ); - - it( 'binds DropdownPanel#model to the view', () => { - assertBinding( dropdown.panel.model, - { isVisible: false }, - [ - [ dropdown.view, { isOpen: true } ] - ], - { isVisible: true } - ); - } ); - } ); -} ); diff --git a/tests/dropdown/dropdownbuttonview.js b/tests/dropdown/dropdownbuttonview.js deleted file mode 100644 index 44368a6..0000000 --- a/tests/dropdown/dropdownbuttonview.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, dropdown */ - -import DropdownButtonView from 'ckeditor5/ui/dropdown/dropdownbuttonview.js'; - -describe( 'DropdownButtonView', () => { - let view; - - beforeEach( () => { - view = new DropdownButtonView(); - } ); - - describe( 'constructor()', () => { - it( 'creates element from template', () => { - expect( view.element.classList.contains( 'ck-dropdown__button' ) ).to.be.true; - } ); - } ); -} ); diff --git a/tests/dropdown/dropdownpanel.js b/tests/dropdown/dropdownpanel.js deleted file mode 100644 index bf82a67..0000000 --- a/tests/dropdown/dropdownpanel.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, dropdown */ - -import DropdownPanel from 'ckeditor5/ui/dropdown/dropdownpanel.js'; -import DropdownPanelView from 'ckeditor5/ui/dropdown/dropdownpanelview.js'; -import ControllerCollection from 'ckeditor5/ui/controllercollection.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'DropdownPanel', () => { - let panel, model; - - beforeEach( () => { - model = new Model( { - isVisible: true - } ); - panel = new DropdownPanel( model, new DropdownPanelView() ); - } ); - - describe( 'constructor()', () => { - it( 'creates "content" collection', () => { - expect( panel.collections.get( 'content' ) ).to.be.instanceof( ControllerCollection ); - } ); - - it( 'binds view attributes to the DropdownPanel#model', () => { - expect( panel.view.isVisble ).to.equal( model.isVisble ); - } ); - } ); -} ); diff --git a/tests/dropdown/list/listdropdown.js b/tests/dropdown/list/listdropdown.js deleted file mode 100644 index b4d3772..0000000 --- a/tests/dropdown/list/listdropdown.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, dropdown */ - -import Collection from 'ckeditor5/utils/collection.js'; -import Model from 'ckeditor5/ui/model.js'; -import ListDropdown from 'ckeditor5/ui/dropdown/list/listdropdown.js'; -import ListDropdownView from 'ckeditor5/ui/dropdown/list/listdropdownview.js'; - -import List from 'ckeditor5/ui/list/list.js'; -import ListView from 'ckeditor5/ui/list/listview.js'; - -describe( 'ListDropdown', () => { - let model, content, view, dropdown; - - beforeEach( () => { - content = new Model( { - items: new Collection() - } ); - - model = new Model( { - isEnabled: true, - content: content, - isOn: false, - label: 'foo' - } ); - - view = new ListDropdownView(); - dropdown = new ListDropdown( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'adds a list to the panel', () => { - const contentCollection = dropdown.panel.collections.get( 'content' ); - - expect( contentCollection ).to.have.length( 1 ); - - expect( contentCollection.get( 0 ) ).to.be.instanceof( List ); - expect( contentCollection.get( 0 ).view ).to.be.instanceof( ListView ); - expect( contentCollection.get( 0 ).model ).to.equal( content ); - } ); - - it( 'delegates model.content#execute to the model', ( done ) => { - model.on( 'execute', ( evt ) => { - expect( evt.source ).to.equal( content ); - expect( evt.path ).to.deep.equal( [ content, model ] ); - done(); - } ); - - content.fire( 'execute' ); - } ); - - it( 'changes view#isOpen on model#execute', () => { - view.isOpen = true; - - model.fire( 'execute' ); - expect( view.isOpen ).to.be.false; - - model.fire( 'execute' ); - expect( view.isOpen ).to.be.false; - } ); - } ); -} ); diff --git a/tests/dropdown/list/listdropdownview.js b/tests/dropdown/list/listdropdownview.js deleted file mode 100644 index 595485c..0000000 --- a/tests/dropdown/list/listdropdownview.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* globals document, Event */ -/* bender-tags: ui, dropdown */ - -import ListDropdown from 'ckeditor5/ui/dropdown/list/listdropdown.js'; -import ListDropdownView from 'ckeditor5/ui/dropdown/list/listdropdownview.js'; -import Model from 'ckeditor5/ui/model.js'; -import Collection from 'ckeditor5/utils/collection.js'; - -describe( 'ListDropdownView', () => { - let model, dropdown, view; - - beforeEach( () => { - model = new Model( { - isEnabled: true, - content: new Model( { - items: new Collection() - } ), - isOn: false, - label: 'foo' - } ); - - view = new ListDropdownView(); - dropdown = new ListDropdown( model, view ); - - return dropdown.init().then( () => { - document.body.appendChild( view.element ); - } ); - } ); - - describe( 'constructor()', () => { - it( 'listens to model#isOn and reacts to DOM events (valid target)', () => { - // Open the dropdown. - view.isOpen = true; - expect( Object.keys( view._listeningTo ) ).to.have.length( 2 ); - - // Fire event from outside of the dropdown. - document.body.dispatchEvent( new Event( 'click', { - bubbles: true - } ) ); - - // Closed the dropdown. - expect( view.isOpen ).to.be.false; - expect( Object.keys( view._listeningTo ) ).to.have.length( 1 ); - - // Fire event from outside of the dropdown. - document.body.dispatchEvent( new Event( 'click', { - bubbles: true - } ) ); - - // Dropdown is still closed. - expect( view.isOpen ).to.be.false; - expect( Object.keys( view._listeningTo ) ).to.have.length( 1 ); - } ); - - it( 'listens to model#isOn and reacts to DOM events (invalid target)', () => { - // Open the dropdown. - view.isOpen = true; - expect( Object.keys( view._listeningTo ) ).to.have.length( 2 ); - - // Event from view.element should be discarded. - view.element.dispatchEvent( new Event( 'click', { - bubbles: true - } ) ); - - // Dropdown is still open. - expect( view.isOpen ).to.be.true; - expect( Object.keys( view._listeningTo ) ).to.have.length( 2 ); - - // Event from within view.element should be discarded. - const child = document.createElement( 'div' ); - view.element.appendChild( child ); - - child.dispatchEvent( new Event( 'click', { - bubbles: true - } ) ); - - // Dropdown is still open. - expect( view.isOpen ).to.be.true; - expect( Object.keys( view._listeningTo ) ).to.have.length( 2 ); - } ); - } ); -} ); diff --git a/tests/editableui/editableui.js b/tests/editableui/editableui.js deleted file mode 100644 index 8f205e6..0000000 --- a/tests/editableui/editableui.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* globals document */ -/* bender-tags: editable */ - -import StandardEditor from 'ckeditor5/core/editor/standardeditor.js'; -import EditableUI from 'ckeditor5/ui/editableui/editableui.js'; -import EditableUIView from 'ckeditor5/ui/editableui/editableuiview.js'; -import testUtils from 'tests/utils/_utils/utils.js'; - -describe( 'EditableUI', () => { - let editable, editableUI, editableUIView, editor; - - beforeEach( () => { - editor = new StandardEditor(); - editable = editor.editing.view.createRoot( document.createElement( 'div' ) ); - editableUIView = new EditableUIView( editor.locale ); - editableUI = new EditableUI( editable, editableUIView, editor ); - } ); - - describe( 'constructor()', () => { - it( 'sets all properties', () => { - expect( editableUI.editor ).to.equal( editor ); - } ); - - describe( 'binds editableUIView attributes to the editable', () => { - it( 'binds isFocused to editable.isFocused', () => { - testUtils.assertBinding( - editableUIView, - { isFocused: false }, - [ - [ editable, { isFocused: true } ] - ], - { isFocused: true } - ); - } ); - - it( 'binds isReadOnly to editable.isReadOnly', () => { - testUtils.assertBinding( - editableUIView, - { isReadOnly: false }, - [ - [ editable, { isReadOnly: true } ] - ], - { isReadOnly: true } - ); - } ); - } ); - - it( 'sets editableUIView#name to editable#rootName', () => { - expect( editableUIView.name ).to.equal( editable.rootName ); - } ); - } ); -} ); diff --git a/tests/editorui/boxed/boxededitorui.js b/tests/editorui/boxed/boxededitorui.js deleted file mode 100644 index 10d2510..0000000 --- a/tests/editorui/boxed/boxededitorui.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -import Editor from 'ckeditor5/core/editor/editor.js'; -import BoxedEditorUI from 'ckeditor5/ui/editorui/boxed/boxededitorui.js'; -import ControllerCollection from 'ckeditor5/ui/controllercollection.js'; - -describe( 'BoxedEditorUI', () => { - let editor, boxedEditorUI; - - beforeEach( () => { - editor = new Editor( null, { - ui: { - width: 100, - height: 200 - } - } ); - boxedEditorUI = new BoxedEditorUI( editor ); - } ); - - describe( 'constructor()', () => { - it( 'adds controller collections', () => { - expect( boxedEditorUI.collections.get( 'top' ) ).to.be.instanceof( ControllerCollection ); - expect( boxedEditorUI.collections.get( 'main' ) ).to.be.instanceof( ControllerCollection ); - } ); - - it( 'sets "width" and "height" attributes', () => { - expect( boxedEditorUI.width ).to.equal( editor.config.get( 'ui.width' ) ); - expect( boxedEditorUI.height ).to.equal( editor.config.get( 'ui.height' ) ); - } ); - } ); -} ); diff --git a/tests/editorui/editorui.js b/tests/editorui/editorui.js deleted file mode 100644 index 308d4d0..0000000 --- a/tests/editorui/editorui.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -import testUtils from 'tests/core/_utils/utils.js'; -import Editor from 'ckeditor5/core/editor/editor.js'; -import EditorUI from 'ckeditor5/ui/editorui/editorui.js'; -import ComponentFactory from 'ckeditor5/ui/componentfactory.js'; -import ControllerCollection from 'ckeditor5/ui/controllercollection.js'; - -testUtils.createSinonSandbox(); - -describe( 'EditorUI', () => { - let editor, editorUI; - - beforeEach( () => { - editor = new Editor(); - editorUI = new EditorUI( editor ); - } ); - - describe( 'constructor()', () => { - it( 'sets all the properties', () => { - expect( editorUI ).to.have.property( 'editor', editor ); - - expect( editorUI.featureComponents ).to.be.instanceof( ComponentFactory ); - - expect( editorUI.collections.get( 'body' ) ).to.be.instanceof( ControllerCollection ); - } ); - } ); - - describe( 'init', () => { - it( 'calls _setupIconManager when "icon" in model', () => { - const spy = testUtils.sinon.spy( editorUI, '_setupIconManager' ); - - return editorUI.init() - .then( () => { - expect( spy.calledOnce ).to.be.true; - } ); - } ); - } ); - - describe( '_setupIconManager', () => { - it( 'sets "icon" property', () => { - editorUI._setupIconManager(); - - expect( editorUI.icons ).to.be.an( 'array' ); - expect( editorUI.icons ).to.not.be.empty; - } ); - } ); -} ); diff --git a/tests/icon/icon.js b/tests/icon/icon.js deleted file mode 100644 index ea71abf..0000000 --- a/tests/icon/icon.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, icon */ - -import Icon from 'ckeditor5/ui/icon/icon.js'; -import IconView from 'ckeditor5/ui/icon/iconview.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'Icon', () => { - let model, icon, view; - - beforeEach( () => { - model = new Model( { - name: 'foo' - } ); - - view = new IconView(); - icon = new Icon( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'binds view attributes to the Icon#model', () => { - expect( view.name ).to.equal( model.name ); - } ); - } ); -} ); diff --git a/tests/iconmanager/iconmanager.js b/tests/iconmanager/iconmanager.js deleted file mode 100644 index 3a29c16..0000000 --- a/tests/iconmanager/iconmanager.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, iconmanager */ - -import Model from 'ckeditor5/ui/model.js'; -import IconManager from 'ckeditor5/ui/iconmanager/iconmanager.js'; -import IconManagerView from 'ckeditor5/ui/iconmanager/iconmanagerview.js'; - -describe( 'IconManager', () => { - let model, view; - - beforeEach( () => { - view = new IconManagerView(); - model = new Model( { - sprite: 'foo', - icons: [ 'bar' ] - } ); - - return new IconManager( model, view ).init(); - } ); - - describe( 'constructor()', () => { - it( 'binds view attributes to the IconManager#model', () => { - expect( view.sprite ).to.equal( model.sprite ); - } ); - } ); -} ); diff --git a/tests/inputtext/inputtext.js b/tests/inputtext/inputtext.js deleted file mode 100644 index 1dd97f5..0000000 --- a/tests/inputtext/inputtext.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, input */ - -import InputText from 'ckeditor5/ui/inputtext/inputtext.js'; -import InputTextView from 'ckeditor5/ui/inputtext/inputtextview.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'InputText', () => { - let model, inputText, view; - - beforeEach( () => { - model = new Model( { - value: 'foo', - id: 'bar' - } ); - - view = new InputTextView(); - inputText = new InputText( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'should bind view attributes to the InputText#model', () => { - expect( view.value ).to.equal( model.value ).to.equal( 'foo' ); - expect( view.id ).to.equal( model.id ).to.equal( 'bar' ); - } ); - } ); - - describe( 'value', () => { - it( 'should return InputText value', () => { - inputText.model.value = 'baz'; - - expect( inputText.value ).to.equal( 'baz' ); - } ); - } ); -} ); diff --git a/tests/label/label.js b/tests/label/label.js deleted file mode 100644 index 2ab340f..0000000 --- a/tests/label/label.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, label */ - -import Label from 'ckeditor5/ui/label/label.js'; -import LabelView from 'ckeditor5/ui/label/labelview.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'Label', () => { - let model, label, view; - - beforeEach( () => { - model = new Model( { - text: 'foo', - for: 'bar' - } ); - - view = new LabelView(); - label = new Label( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'should bind view attributes to the Label#model', () => { - expect( view.text ).to.equal( model.text ).to.equal( 'foo' ); - expect( view.for ).to.equal( model.for ).to.equal( 'bar' ); - } ); - } ); -} ); diff --git a/tests/labeledinput/labeledinput.js b/tests/labeledinput/labeledinput.js deleted file mode 100644 index c55b9f9..0000000 --- a/tests/labeledinput/labeledinput.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, input */ - -import LabeledInput from 'ckeditor5/ui/labeledinput/labeledinput.js'; -import LabeledInputView from 'ckeditor5/ui/labeledinput/labeledinputview.js'; -import Model from 'ckeditor5/ui/model.js'; - -import Label from 'ckeditor5/ui/label/label.js'; -import InputText from 'ckeditor5/ui/inputtext/inputtext.js'; -import InputTextView from 'ckeditor5/ui/inputtext/inputtextview.js'; - -import utilsTestUtils from 'tests/utils/_utils/utils.js'; - -const assertBinding = utilsTestUtils.assertBinding; - -describe( 'LabeledInput', () => { - let model, labeledInput, view; - - beforeEach( () => { - model = new Model( { - label: 'some label', - value: 'some value' - } ); - - view = new LabeledInputView( InputTextView ); - labeledInput = new LabeledInput( model, view, InputText, new Model() ); - } ); - - describe( 'constructor()', () => { - describe( 'child components', () => { - describe( 'label', () => { - it( 'should be created', () => { - expect( labeledInput.label ).to.instanceof( Label ); - } ); - - it( 'should have Label.model#label bound to the #model"', () => { - assertBinding( labeledInput.label.model, - { text: 'some label' }, - [ - [ model, { label: 'new label' } ] - ], - { text: 'new label' } - ); - } ); - - it( 'should have na unique for attribute', () => { - expect( labeledInput.label.model.for ).to.match( /^ck-input-[0-9]+$/ ); - } ); - } ); - - describe( 'input', () => { - it( 'should be attached', () => { - expect( labeledInput.input ).to.instanceof( InputText ); - } ); - - it( 'should have InputText.model#value bound to the #model', () => { - assertBinding( labeledInput.input.model, - { value: 'some value' }, - [ - [ model, { value: 'new value' } ] - ], - { value: 'new value' } - ); - } ); - - it( 'should have an unique id attribute', () => { - expect( labeledInput.input.model.id ).to.match( /^ck-input-[0-9]+$/ ); - } ); - - describe( 'view', () => { - it( 'should inherit the locale', () => { - expect( labeledInput.input.view.locale ).to.equal( labeledInput.view.locale ); - } ); - } ); - } ); - } ); - } ); - - describe( 'value', () => { - it( 'should return LabeledInput value', () => { - labeledInput.model.value = 'baz'; - - expect( labeledInput.value ).to.equal( 'baz' ); - } ); - } ); -} ); diff --git a/tests/list/list.js b/tests/list/list.js deleted file mode 100644 index 23a6427..0000000 --- a/tests/list/list.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, list */ - -import testUtils from 'tests/core/_utils/utils.js'; - -import List from 'ckeditor5/ui/list/list.js'; -import ListView from 'ckeditor5/ui/list/listview.js'; - -import Collection from 'ckeditor5/utils/collection.js'; -import Controller from 'ckeditor5/ui/controller.js'; -import ControllerCollection from 'ckeditor5/ui/controllercollection.js'; -import Model from 'ckeditor5/ui/model.js'; - -testUtils.createSinonSandbox(); - -describe( 'List', () => { - let model, list, items, itemFoo, itemBar, itemBaz; - - beforeEach( () => { - itemFoo = new Model( { label: 'foo', style: 'foostyle' } ); - itemBar = new Model( { label: 'bar', style: 'barstyle' } ); - itemBaz = new Model( { label: 'baz', style: 'barstyle' } ); - - items = new Collection( { idProperty: 'label' } ); - - items.add( itemBaz ); - - model = new Model( { - items: items - } ); - - list = new List( model, new ListView() ); - } ); - - describe( 'constructor()', () => { - it( 'creates list collection', () => { - expect( list.collections ).to.have.length( 2 ); - expect( list.collections.get( 'list' ) ).to.be.instanceof( ControllerCollection ); - } ); - - it( 'delegates ListItemModel#execute event to the model', ( done ) => { - model.on( 'execute', ( evt ) => { - expect( evt.source ).to.equal( itemBaz ); - expect( evt.path ).to.deep.equal( [ itemBaz, model ] ); - done(); - } ); - - itemBaz.fire( 'execute' ); - } ); - } ); - - describe( 'init', () => { - it( 'fills the "list" collection with model#items', () => { - const listCollection = list.collections.get( 'list' ); - - items.add( itemFoo ); - list.init(); - items.add( itemBar ); - - expect( listCollection ).to.have.length( 3 ); - expect( listCollection.get( 0 ).model ).to.equal( itemBaz ); - expect( listCollection.get( 1 ).model ).to.equal( itemFoo ); - expect( listCollection.get( 2 ).model ).to.equal( itemBar ); - } ); - - it( 'binds the "list" collection to model#items', () => { - const listCollection = list.collections.get( 'list' ); - - items.add( itemFoo ); - list.init(); - items.add( itemBar ); - - const removed = items.remove( 1 ); - - items.add( removed, 0 ); - - expect( listCollection.get( 0 ).model ).to.equal( itemFoo ); - expect( listCollection.get( 1 ).model ).to.equal( itemBaz ); - expect( listCollection.get( 2 ).model ).to.equal( itemBar ); - } ); - - it( 'calls super.init()', () => { - const spy = testUtils.sinon.spy( Controller.prototype, 'init' ); - - list.init(); - - expect( spy.calledOnce ).to.be.true; - } ); - } ); -} ); diff --git a/tests/list/listitem.js b/tests/list/listitem.js deleted file mode 100644 index 0157ee1..0000000 --- a/tests/list/listitem.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, list */ - -import ListItem from 'ckeditor5/ui/list/listitem.js'; -import ListItemView from 'ckeditor5/ui/list/listitemview.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'ListItem', () => { - let model, view; - - beforeEach( () => { - model = new Model( { - label: 'bar' - } ); - - view = new ListItemView(); - - return new ListItem( model, view ).init(); - } ); - - describe( 'constructor()', () => { - it( 'binds view attributes to the ListItem#model', () => { - expect( view.label ).to.equal( model.label ); - expect( view.style ).to.be.undefined; - } ); - - it( 'binds view#style to ListItem.model#style when present', () => { - model.set( 'style', 'foo' ); - - view = new ListItemView(); - - return new ListItem( model, view ).init().then( () => { - expect( view.style ).to.equal( 'foo' ); - } ); - } ); - - it( 'creates view#click -> model#execute event propagation', ( done ) => { - model.on( 'execute', () => { - done(); - } ); - - view.fire( 'click' ); - } ); - } ); -} ); diff --git a/tests/toolbar/sticky/stickytoolbar.js b/tests/toolbar/sticky/stickytoolbar.js deleted file mode 100644 index 6cc9080..0000000 --- a/tests/toolbar/sticky/stickytoolbar.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* globals document */ -/* bender-tags: ui, toolbar */ - -import Model from 'ckeditor5/ui/model.js'; -import View from 'ckeditor5/ui/view.js'; -import StickyToolbar from 'ckeditor5/ui/toolbar/sticky/stickytoolbar.js'; - -describe( 'StickyToolbar', () => { - let toolbar, view, model, limiterElement; - - beforeEach( () => { - limiterElement = document.createElement( 'div' ); - - model = new Model( { - isActive: false, - limiterElement: limiterElement - } ); - - view = new View(); - toolbar = new StickyToolbar( model, view ); - } ); - - describe( 'constructor()', () => { - it( 'binds view attributes to the StickyToolbar#model', () => { - expect( view.isActive ).to.equal( model.isActive ); - expect( view.limiterElement ).to.equal( limiterElement ); - } ); - } ); -} ); diff --git a/tests/toolbar/toolbar.js b/tests/toolbar/toolbar.js deleted file mode 100644 index 49e157c..0000000 --- a/tests/toolbar/toolbar.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.md. - */ - -/* bender-tags: ui, toolbar */ - -import Toolbar from 'ckeditor5/ui/toolbar/toolbar.js'; -import ToolbarView from 'ckeditor5/ui/toolbar/toolbarview.js'; -import ControllerCollection from 'ckeditor5/ui/controllercollection.js'; -import Model from 'ckeditor5/ui/model.js'; - -describe( 'Toolbar', () => { - let model, toolbar; - - beforeEach( () => { - model = new Model(); - - toolbar = new Toolbar( model, new ToolbarView() ); - } ); - - describe( 'constructor()', () => { - it( 'accepts a model instance', () => { - expect( toolbar.model ).to.equal( model ); - } ); - - it( 'creates buttons collection', () => { - expect( toolbar.collections.get( 'items' ) ).to.be.instanceof( ControllerCollection ); - } ); - } ); -} );