8
0
Просмотр исходного кода

Add tests for checking if horizontal alignment lables are set in a proper order for both LTR and RTL modes

panr 5 лет назад
Родитель
Сommit
005ff6fb31

+ 23 - 1
packages/ckeditor5-table/tests/tablecellproperties/ui/tablecellpropertiesview.js

@@ -474,7 +474,7 @@ describe( 'table cell properties', () => {
 							expect( toolbar.ariaLabel ).to.equal( 'Horizontal text alignment toolbar' );
 							expect( toolbar.ariaLabel ).to.equal( 'Horizontal text alignment toolbar' );
 						} );
 						} );
 
 
-						it( 'should bring alignment buttons', () => {
+						it( 'should bring alignment buttons in the right order in LTR (default)', () => {
 							expect( toolbar.items.map( ( { label } ) => label ) ).to.have.ordered.members( [
 							expect( toolbar.items.map( ( { label } ) => label ) ).to.have.ordered.members( [
 								'Align cell text to the left',
 								'Align cell text to the left',
 								'Align cell text to the center',
 								'Align cell text to the center',
@@ -487,6 +487,28 @@ describe( 'table cell properties', () => {
 							] );
 							] );
 						} );
 						} );
 
 
+						it( 'should bring alignment buttons in the right order in RTL', () => {
+							// Creates its own local instances of locale, view and toolbar.
+							const locale = {
+								t: val => val,
+								uiLanguageDirection: 'rtl',
+								contentLanguageDirection: 'rtl'
+							};
+							const view = new TableCellPropertiesView( locale, VIEW_OPTIONS );
+							const toolbar = view.horizontalAlignmentToolbar;
+
+							expect( toolbar.items.map( ( { label } ) => label ) ).to.have.ordered.members( [
+								'Align cell text to the right',
+								'Align cell text to the center',
+								'Align cell text to the left',
+								'Justify cell text'
+							] );
+
+							expect( toolbar.items.map( ( { isOn } ) => isOn ) ).to.have.ordered.members( [
+								true, false, false, false
+							] );
+						} );
+
 						it( 'should change the #horizontalAlignment value', () => {
 						it( 'should change the #horizontalAlignment value', () => {
 							toolbar.items.last.fire( 'execute' );
 							toolbar.items.last.fire( 'execute' );
 							expect( view.horizontalAlignment ).to.equal( 'justify' );
 							expect( view.horizontalAlignment ).to.equal( 'justify' );