瀏覽代碼

Tests: Added EditorUIView tests for integration with LTR/RTL languages.

Aleksander Nowodzinski 6 年之前
父節點
當前提交
fe2b60a695

+ 1 - 1
packages/ckeditor5-ui/tests/editableui/editableuiview.js

@@ -12,7 +12,7 @@ import View from '../../src/view';
 import Locale from '@ckeditor/ckeditor5-utils/src/locale';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-describe.only( 'EditableUIView', () => {
+describe( 'EditableUIView', () => {
 	let view, editableElement, editingView, editingViewRoot, locale;
 
 	testUtils.createSinonSandbox();

+ 19 - 0
packages/ckeditor5-ui/tests/editorui/editoruiview.js

@@ -46,6 +46,25 @@ describe( 'EditorUIView', () => {
 			expect( el.classList.contains( 'ck-rounded-corners' ) ).to.be.true;
 			expect( el.classList.contains( 'ck-reset_all' ) ).to.be.true;
 		} );
+
+		it( 'sets the right dir attribute to the body region (LTR)', () => {
+			const el = view._bodyCollectionContainer;
+
+			expect( el.getAttribute( 'dir' ) ).to.equal( 'ltr' );
+		} );
+
+		it( 'sets the right dir attribute to the body region (RTL)', () => {
+			const locale = new Locale( 'ar' );
+			const view = new EditorUIView( locale );
+
+			view.render();
+
+			const el = view._bodyCollectionContainer;
+
+			expect( el.getAttribute( 'dir' ) ).to.equal( 'rtl' );
+
+			view.destroy();
+		} );
 	} );
 
 	describe( 'destroy()', () => {