Skip to content

Commit

Permalink
Merge pull request #8672 from ckeditor/i/8655-grouped-toolbar-tooltip
Browse files Browse the repository at this point in the history
Fix (ui): The "Show more items" toolbar button tooltip should not overflow the editor. Closes #8655.
  • Loading branch information
oleq committed Dec 22, 2020
2 parents 2d9954c + fc30fe6 commit 6175a20
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ckeditor5-ui/src/toolbar/toolbarview.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ class DynamicGrouping {
dropdown.buttonView.set( {
label: t( 'Show more items' ),
tooltip: true,
tooltipPosition: locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw',
icon: verticalDotsIcon
} );

Expand Down
20 changes: 20 additions & 0 deletions packages/ckeditor5-ui/tests/toolbar/toolbarview.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,26 @@ describe( 'ToolbarView', () => {
expect( groupedItemsDropdown.buttonView.label ).to.equal( 'Show more items' );
} );

it( 'tooltip has the proper position depending on the UI language direction (LTR UI)', () => {
const locale = new Locale( { uiLanguage: 'en' } );
const view = new ToolbarView( locale, { shouldGroupWhenFull: true } );
view.render();

expect( view._behavior.groupedItemsDropdown.buttonView.tooltipPosition ).to.equal( 'sw' );

view.destroy();
} );

it( 'tooltip has the proper position depending on the UI language direction (RTL UI)', () => {
const locale = new Locale( { uiLanguage: 'ar' } );
const view = new ToolbarView( locale, { shouldGroupWhenFull: true } );
view.render();

expect( view._behavior.groupedItemsDropdown.buttonView.tooltipPosition ).to.equal( 'se' );

view.destroy();
} );

it( 'shares its toolbarView#items with grouped items', () => {
view.items.add( focusable() );
view.items.add( focusable() );
Expand Down

0 comments on commit 6175a20

Please sign in to comment.