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

Revert "Remove unit test, for wrongly translated label." Translation are now avaialble in different form.

This reverts commit 3c27957780f6eb7f76dbe387e5ec9bd6c3f84ea7.
Mateusz Samsel 6 лет назад
Родитель
Сommit
14ad7e8691
1 измененных файлов с 54 добавлено и 1 удалено
  1. 54 1
      packages/ckeditor5-link/tests/ui/linkformview.js

+ 54 - 1
packages/ckeditor5-link/tests/ui/linkformview.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
  */
 
 
-/* globals Event */
+/* globals Event, document */
 
 
 import LinkFormView from '../../src/ui/linkformview';
 import LinkFormView from '../../src/ui/linkformview';
 import View from '@ckeditor/ckeditor5-ui/src/view';
 import View from '@ckeditor/ckeditor5-ui/src/view';
@@ -15,6 +15,9 @@ import ViewCollection from '@ckeditor/ckeditor5-ui/src/viewcollection';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import ManualDecorator from '../../src/utils/manualdecorator';
 import ManualDecorator from '../../src/utils/manualdecorator';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 import Collection from '@ckeditor/ckeditor5-utils/src/collection';
+import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/ckeditor5-utils/src/translation-service';
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+import Link from '../../src/link';
 
 
 describe( 'LinkFormView', () => {
 describe( 'LinkFormView', () => {
 	let view;
 	let view;
@@ -282,4 +285,54 @@ describe( 'LinkFormView', () => {
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
+
+	describe( 'localization of custom attributes', () => {
+		before( () => {
+			addTranslations( 'pl', {
+				'Open in new window': 'Otwórz w nowym oknie'
+			} );
+		} );
+		after( () => {
+			clearTranslations();
+		} );
+
+		let editor, editorElement, linkFormView;
+
+		beforeEach( () => {
+			editorElement = document.createElement( 'div' );
+			document.body.appendChild( editorElement );
+
+			return ClassicTestEditor
+				.create( editorElement, {
+					plugins: [ Link ],
+					toolbar: [ 'link' ],
+					language: 'pl',
+					link: {
+						decorators: [
+							{
+								mode: 'manual',
+								label: 'Open in new window',
+								attributes: {
+									target: '_blank'
+								}
+							}
+						]
+					}
+				} )
+				.then( newEditor => {
+					editor = newEditor;
+					linkFormView = new LinkFormView( editor.locale, editor.commands.get( 'link' ).customAttributes );
+				} );
+		} );
+
+		afterEach( () => {
+			editorElement.remove();
+
+			return editor.destroy();
+		} );
+
+		it( 'translates labels of manual decorators UI', () => {
+			expect( linkFormView.customAttributesView.first.label ).to.equal( 'Otwórz w nowym oknie' );
+		} );
+	} );
 } );
 } );