Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #128 from ckeditor/t/ckeditor5/1403
Browse files Browse the repository at this point in the history
Fix: The UI buttons should be marked as toggleable for better assistive technologies support (see ckeditor/ckeditor5#1403).
  • Loading branch information
oleq committed Aug 12, 2019
2 parents 94cfdff + 1476735 commit 5c41c1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/headingbuttonsui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
11 changes: 11 additions & 0 deletions tests/headingbuttonsui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 5c41c1a

Please sign in to comment.