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

Commit

Permalink
Aligned the code to the latest Locale class API.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Aug 9, 2019
1 parent ea3effa commit c0daf34
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export default class DropdownView extends View {
get _panelPositions() {
const { southEast, southWest, northEast, northWest } = DropdownView.defaultPanelPositions;

if ( this.locale.languageDirection === 'ltr' ) {
if ( this.locale.uiLanguageDirection === 'ltr' ) {
return [ southEast, southWest, northEast, northWest ];
} else {
return [ southWest, southEast, northWest, northEast ];
Expand Down
4 changes: 2 additions & 2 deletions src/editorui/boxed/boxededitoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default class BoxedEditorUIView extends EditorUIView {
'ck-rounded-corners'
],
role: 'application',
dir: locale.languageDirection,
lang: locale.language,
dir: locale.uiLanguageDirection,
lang: locale.uiLanguage,
'aria-labelledby': `ck-editor__aria-label_${ ariaLabelUid }`
},

Expand Down
2 changes: 1 addition & 1 deletion src/editorui/editoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class EditorUIView extends View {
'ck-body',
'ck-rounded-corners'
],
dir: locale.languageDirection,
dir: locale.uiLanguageDirection,
},
children: this.body
} ).render();
Expand Down
2 changes: 1 addition & 1 deletion src/toolbar/block/blocktoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export default class BlockToolbar extends Plugin {
( contentRect, buttonRect ) => {
let left;

if ( this.editor.locale.languageDirection === 'ltr' ) {
if ( this.editor.locale.uiLanguageDirection === 'ltr' ) {
left = editableRect.left - buttonRect.width;
} else {
left = editableRect.right;
Expand Down
4 changes: 2 additions & 2 deletions tests/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe( 'DropdownView', () => {

beforeEach( () => {
locale = {
languageDirection: 'ltr',
uiLanguageDirection: 'ltr',
t() {}
};

Expand Down Expand Up @@ -150,7 +150,7 @@ describe( 'DropdownView', () => {
const spy = testUtils.sinon.spy( DropdownView, '_getOptimalPosition' );
const { southEast, southWest, northEast, northWest } = DropdownView.defaultPanelPositions;

view.locale.languageDirection = 'rtl';
view.locale.uiLanguageDirection = 'rtl';
view.isOpen = true;

sinon.assert.calledWithExactly( spy, sinon.match( {
Expand Down
9 changes: 6 additions & 3 deletions tests/editableui/editableuiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe( 'EditableUIView', () => {
testUtils.createSinonSandbox();

beforeEach( () => {
locale = new Locale( 'en' );
locale = new Locale();
editableElement = document.createElement( 'div' );

editingView = new EditingView();
Expand Down Expand Up @@ -80,7 +80,7 @@ describe( 'EditableUIView', () => {
} );

it( 'sets proper lang and dir attributes (implicit content language)', () => {
const locale = new Locale( 'ar' );
const locale = new Locale( { uiLanguage: 'ar' } );
const view = new EditableUIView( locale, editingView );
view.name = editingViewRoot.rootName;

Expand All @@ -93,7 +93,10 @@ describe( 'EditableUIView', () => {
} );

it( 'sets proper lang and dir attributes (explicit content language)', () => {
const locale = new Locale( 'pl', 'ar' );
const locale = new Locale( {
uiLanguage: 'pl',
contentLanguage: 'ar'
} );
const view = new EditableUIView( locale, editingView );
view.name = editingViewRoot.rootName;

Expand Down
4 changes: 2 additions & 2 deletions tests/editorui/boxed/boxededitoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe( 'BoxedEditorUIView', () => {
let view, element;

beforeEach( () => {
view = new BoxedEditorUIView( new Locale( 'en' ) );
view = new BoxedEditorUIView( new Locale() );
view.render();
element = view.element;
} );
Expand Down Expand Up @@ -62,7 +62,7 @@ describe( 'BoxedEditorUIView', () => {
} );

it( 'sets the proper "dir" attribute value when using RTL language', () => {
const view = new BoxedEditorUIView( new Locale( 'ar' ) );
const view = new BoxedEditorUIView( new Locale( { uiLanguage: 'ar' } ) );

view.render();

Expand Down
4 changes: 2 additions & 2 deletions tests/editorui/editoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe( 'EditorUIView', () => {
testUtils.createSinonSandbox();

beforeEach( () => {
locale = new Locale( 'en' );
locale = new Locale();
view = new EditorUIView( locale );

view.render();
Expand Down Expand Up @@ -54,7 +54,7 @@ describe( 'EditorUIView', () => {
} );

it( 'sets the right dir attribute to the body region (RTL)', () => {
const locale = new Locale( 'ar' );
const locale = new Locale( { uiLanguage: 'ar' } );
const view = new EditorUIView( locale );

view.render();
Expand Down
2 changes: 1 addition & 1 deletion tests/toolbar/block/blocktoolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ describe( 'BlockToolbar', () => {
} );

it( 'should attach the left side of the button to the right side of the editable when language direction is RTL', () => {
editor.locale.languageDirection = 'rtl';
editor.locale.uiLanguageDirection = 'rtl';

setData( editor.model, '<paragraph>foo[]bar</paragraph>' );

Expand Down

0 comments on commit c0daf34

Please sign in to comment.