Przeglądaj źródła

Set buttons as toggleable and add unit test to check it.

Mateusz Samsel 6 lat temu
rodzic
commit
eae14be5d4

+ 1 - 0
packages/ckeditor5-highlight/src/highlightui.js

@@ -120,6 +120,7 @@ export default class HighlightUI extends Plugin {
 			button.bind( 'isEnabled' ).to( command, 'isEnabled' );
 			button.bind( 'isOn' ).to( command, 'value', value => value === option.model );
 			button.iconView.fillColor = option.color;
+			button.isToggleable = true;
 		}
 	}
 

+ 7 - 0
packages/ckeditor5-highlight/tests/highlightui.js

@@ -124,6 +124,13 @@ describe( 'HighlightUI', () => {
 				.to.deep.equal( [ false, true, false, false, false, false, undefined, false ] );
 		} );
 
+		it( 'should mark as toggleable all markers and pens', () => {
+			const toolbar = dropdown.toolbarView;
+
+			expect( toolbar.items.map( item => item.isToggleable ) )
+				.to.deep.equal( [ true, true, true, true, true, true, undefined, false ] );
+		} );
+
 		describe( 'toolbar button behavior', () => {
 			let button, buttons, options;