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

Tests: Added test for StickyToolbar bindings.

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

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

@@ -0,0 +1,38 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* bender-tags: ui, stickytoolbar */
+
+'use strict';
+
+import Editor from '/ckeditor5/editor.js';
+import Editable from '/ckeditor5/editable.js';
+import Model from '/ckeditor5/ui/model.js';
+import View from '/ckeditor5/ui/view.js';
+import StickyToolbar from '/ckeditor5/ui/bindings/stickytoolbar.js';
+
+describe( 'StickyToolbar', () => {
+	let toolbar, view, model, editor, editable;
+
+	beforeEach( () => {
+		editor = new Editor();
+		editable = new Editable( editor, 'foo' );
+		model = new Model();
+		view = new View( model );
+		toolbar = new StickyToolbar( model, view, editor );
+	} );
+
+	describe( 'constructor', () => {
+		it( 'binds model#isActive to editor.editables#current', () => {
+			expect( model.isActive ).to.be.false;
+
+			editor.editables.current = editable;
+			expect( model.isActive ).to.be.true;
+
+			editor.editables.current = null;
+			expect( model.isActive ).to.be.false;
+		} );
+	} );
+} );

+ 2 - 2
packages/ckeditor5-ui/tests/bindings/toolbar.js

@@ -20,7 +20,7 @@ describe( 'Toolbar', () => {
 		editor = new Editor();
 		model = new Model();
 		view = new View( model );
-		toolbar = new Toolbar( view, model, editor );
+		toolbar = new Toolbar( model, view, editor );
 	} );
 
 	describe( 'constructor', () => {
@@ -46,7 +46,7 @@ describe( 'Toolbar', () => {
 			expect( createSpy.secondCall.calledWith( 'bar' ) ).to.be.true;
 		} );
 
-		it( 'adds created compoments to the collection of buttons', () => {
+		it( 'adds created components to the collection of buttons', () => {
 			const component = new Controller();
 			const createSpy = sinon.spy( () => component );