8
0
Quellcode durchsuchen

Improved the character group dropdown panel positioning depending on the direction of the language.

Aleksander Nowodzinski vor 6 Jahren
Ursprung
Commit
3ef115e0f0

+ 1 - 0
packages/ckeditor5-special-characters/src/ui/specialcharactersnavigationview.js

@@ -49,6 +49,7 @@ export default class SpecialCharactersNavigationView extends View {
 		 * @member {module:ui/dropdown/dropdownview~DropdownView}
 		 */
 		this.groupDropdownView = this._createGroupDropdown( groupNames );
+		this.groupDropdownView.panelPosition = locale.uiLanguageDirection === 'rtl' ? 'se' : 'sw';
 
 		this.setTemplate( {
 			tag: 'div',

+ 18 - 0
packages/ckeditor5-special-characters/tests/ui/specialcharactersnavigationview.js

@@ -63,6 +63,24 @@ describe( 'SpecialCharactersNavigationView', () => {
 			expect( view.currentGroupName ).to.equal( 'groupA' );
 		} );
 
+		it( 'has a right #panelPosition (LTR)', () => {
+			expect( groupDropdownView.panelPosition ).to.equal( 'sw' );
+		} );
+
+		it( 'has a right #panelPosition (RTL)', () => {
+			const locale = {
+				uiLanguageDirection: 'rtl',
+				t: val => val
+			};
+
+			view = new SpecialCharactersNavigationView( locale, [ 'groupA', 'groupB' ] );
+			view.render();
+
+			expect( view.groupDropdownView.panelPosition ).to.equal( 'se' );
+
+			view.destroy();
+		} );
+
 		it( 'binds its buttonView#label to #value', () => {
 			expect( groupDropdownView.buttonView.label ).to.equal( 'groupA' );