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

Created StickyToolbar bindings.

Aleksander Nowodzinski 9 лет назад
Родитель
Сommit
794a54a776

+ 34 - 0
packages/ckeditor5-ui/src/bindings/stickytoolbar.js

@@ -0,0 +1,34 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import ToolbarBindingsMixin from './toolbarbindingsmixin.js';
+import BaseStickyToolbar from '../stickytoolbar/stickytoolbar.js';
+
+/**
+ * The editor StickyToolbar controller class.
+ *
+ * See {@link ui.stickyToolbar.StickyToolbar}.
+ *
+ * @memberOf ui.bindings
+ * @extends ui.stickyToolbar.StickyToolbar
+ */
+export default class StickyToolbar extends BaseStickyToolbar {
+	/**
+	 * Creates an instance of {@link ui.bindings.StickyToolbar} class.
+	 *
+	 * @param {ui.stickyToolbar.StickyToolbarModel} model Model of this StickyToolbar.
+	 * @param {ui.View} view View of this StickyToolbar.
+	 * @param {ckeditor5.Editor} editor
+	 */
+	constructor( model, view, editor ) {
+		super( model, view );
+
+		this.editor = editor;
+	}
+}
+
+Object.assign( StickyToolbar.prototype, ToolbarBindingsMixin );

+ 31 - 0
packages/ckeditor5-ui/tests/bindings/stickytoolbar.js

@@ -0,0 +1,31 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* bender-tags: ui, toolbar */
+
+'use strict';
+
+import Editor from '/ckeditor5/editor/editor.js';
+import Model from '/ckeditor5/ui/model.js';
+import View from '/ckeditor5/ui/view.js';
+import StickyToolbar from '/ckeditor5/ui/bindings/toolbar.js';
+
+describe( 'StickyToolbar', () => {
+	let toolbar, model, editor;
+
+	beforeEach( () => {
+		editor = new Editor();
+		model = new Model( {
+			isActive: false
+		} );
+		toolbar = new StickyToolbar( model, new View(), editor );
+	} );
+
+	describe( 'constructor', () => {
+		it( 'sets all the properties', () => {
+			expect( toolbar ).to.have.property( 'editor', editor );
+		} );
+	} );
+} );