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

Bound ColorGridView#selectedColor to ColorTableView#selectedColor.

Aleksander Nowodzinski 6 лет назад
Родитель
Сommit
0d84f94fad

+ 1 - 0
packages/ckeditor5-font/src/ui/colortableview.js

@@ -174,6 +174,7 @@ export default class ColorTableView extends View {
 		} );
 		} );
 
 
 		colorGrid.delegate( 'execute' ).to( this );
 		colorGrid.delegate( 'execute' ).to( this );
+		colorGrid.bind( 'selectedColor' ).to( this );
 
 
 		return colorGrid;
 		return colorGrid;
 	}
 	}

+ 8 - 0
packages/ckeditor5-font/tests/ui/colortableview.js

@@ -154,6 +154,14 @@ describe( 'ColorTableView', () => {
 			expect( staticColorTable.items.length ).to.equal( 3 );
 			expect( staticColorTable.items.length ).to.equal( 3 );
 		} );
 		} );
 
 
+		it( 'binds #selectedColor to the table', () => {
+			colorTableView.selectedColor = 'foo';
+			expect( staticColorTable.selectedColor ).to.equal( 'foo' );
+
+			colorTableView.selectedColor = 'bar';
+			expect( staticColorTable.selectedColor ).to.equal( 'bar' );
+		} );
+
 		colorDefinitions.forEach( ( item, index ) => {
 		colorDefinitions.forEach( ( item, index ) => {
 			it( `dispatch event to parent element for color: ${ item.color }`, () => {
 			it( `dispatch event to parent element for color: ${ item.color }`, () => {
 				const spy = sinon.spy();
 				const spy = sinon.spy();