Selaa lähdekoodia

Merge pull request #128 from ckeditor/t/ckeditor5/1403

Fix: The UI buttons should be marked as toggleable for better assistive technologies support (see ckeditor/ckeditor5#1403).
Aleksander Nowodzinski 6 vuotta sitten
vanhempi
commit
d119ed6c89

+ 1 - 0
packages/ckeditor5-heading/src/headingbuttonsui.js

@@ -88,6 +88,7 @@ export default class HeadingButtonsUI extends Plugin {
 			view.label = option.title;
 			view.icon = option.icon || defaultIcons[ option.model ];
 			view.tooltip = true;
+			view.isToggleable = true;
 			view.bind( 'isEnabled' ).to( command );
 			view.bind( 'isOn' ).to( command, 'value', value => value == option.model );
 

+ 11 - 0
packages/ckeditor5-heading/tests/headingbuttonsui.js

@@ -99,6 +99,17 @@ describe( 'HeadingButtonUI', () => {
 			sinon.assert.calledOnce( executeCommandSpy );
 			sinon.assert.calledWithExactly( executeCommandSpy, 'heading', { value: 'heading1' } );
 		} );
+
+		it( 'should be initialized as toggleable button', () => {
+			const factory = editor.ui.componentFactory;
+
+			expect( factory.create( 'heading1' ).isToggleable ).to.be.true;
+			expect( factory.create( 'heading2' ).isToggleable ).to.be.true;
+			expect( factory.create( 'heading3' ).isToggleable ).to.be.true;
+			expect( factory.create( 'heading4' ).isToggleable ).to.be.true;
+			expect( factory.create( 'heading5' ).isToggleable ).to.be.true;
+			expect( factory.create( 'heading6' ).isToggleable ).to.be.true;
+		} );
 	} );
 
 	describe( 'custom config', () => {