Преглед на файлове

Merge branch 'master' into t/ckeditor5-ui/260

Aleksander Nowodzinski преди 8 години
родител
ревизия
92c179d0f0

+ 1 - 1
packages/ckeditor5-link/package.json

@@ -18,7 +18,7 @@
     "@ckeditor/ckeditor5-typing": "^0.9.1",
     "@ckeditor/ckeditor5-undo": "^0.8.1",
     "@ckeditor/ckeditor5-utils": "^0.9.1",
-    "eslint-config-ckeditor5": "^1.0.0",
+    "eslint-config-ckeditor5": "^1.0.5",
     "gulp": "^3.9.1",
     "guppy-pre-commit": "^0.4.0"
   },

+ 1 - 1
packages/ckeditor5-link/src/ui/linkformview.js

@@ -199,7 +199,7 @@ export default class LinkFormView extends View {
 		const labeledInput = new LabeledInputView( this.locale, InputTextView );
 
 		labeledInput.label = t( 'Link URL' );
-		labeledInput.inputView.placeholder = t( 'http://example.com' );
+		labeledInput.inputView.placeholder = 'https://example.com';
 
 		return labeledInput;
 	}

+ 30 - 29
packages/ckeditor5-link/tests/link.js

@@ -28,26 +28,27 @@ describe( 'Link', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor.create( editorElement, {
-			plugins: [ Link, Paragraph ]
-		} )
-		.then( newEditor => {
-			newEditor.editing.view.attachDomRoot( editorElement );
-
-			editor = newEditor;
-
-			linkFeature = editor.plugins.get( Link );
-			linkButton = editor.ui.componentFactory.create( 'link' );
-			unlinkButton = editor.ui.componentFactory.create( 'unlink' );
-			balloon = editor.plugins.get( ContextualBalloon );
-			formView = linkFeature.formView;
-
-			// There is no point to execute BalloonPanelView attachTo and pin methods so lets override it.
-			testUtils.sinon.stub( balloon.view, 'attachTo', () => {} );
-			testUtils.sinon.stub( balloon.view, 'pin', () => {} );
-
-			formView.init();
-		} );
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Link, Paragraph ]
+			} )
+			.then( newEditor => {
+				newEditor.editing.view.attachDomRoot( editorElement );
+
+				editor = newEditor;
+
+				linkFeature = editor.plugins.get( Link );
+				linkButton = editor.ui.componentFactory.create( 'link' );
+				unlinkButton = editor.ui.componentFactory.create( 'unlink' );
+				balloon = editor.plugins.get( ContextualBalloon );
+				formView = linkFeature.formView;
+
+				// There is no point to execute BalloonPanelView attachTo and pin methods so lets override it.
+				testUtils.sinon.stub( balloon.view, 'attachTo' ).returns( {} );
+				testUtils.sinon.stub( balloon.view, 'pin' ).returns( {} );
+
+				formView.init();
+			} );
 	} );
 
 	afterEach( () => {
@@ -240,7 +241,7 @@ describe( 'Link', () => {
 
 				setModelData( editor.document, '<paragraph>f[]oo</paragraph>' );
 
-				const spy = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spy = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 
 				linkFeature._showPanel();
 				viewDocument.render();
@@ -258,7 +259,7 @@ describe( 'Link', () => {
 				setModelData( editor.document, '<paragraph><$text linkHref="url">f[]oo</$text></paragraph>' );
 
 				linkFeature._showPanel();
-				const spy = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spy = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 
 				const root = viewDocument.getRoot();
 				const text = root.getChild( 0 ).getChild( 0 ).getChild( 0 );
@@ -278,7 +279,7 @@ describe( 'Link', () => {
 				setModelData( editor.document, '<paragraph>f[]oo</paragraph>' );
 
 				linkFeature._showPanel();
-				const spy = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spy = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 
 				// Fires #render.
 				const root = viewDocument.getRoot();
@@ -302,7 +303,7 @@ describe( 'Link', () => {
 
 				linkFeature._showPanel();
 
-				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 				const spyHide = testUtils.sinon.spy( linkFeature, '_hidePanel' );
 
 				const root = viewDocument.getRoot();
@@ -327,7 +328,7 @@ describe( 'Link', () => {
 
 				linkFeature._showPanel();
 
-				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 				const spyHide = testUtils.sinon.spy( linkFeature, '_hidePanel' );
 
 				const root = viewDocument.getRoot();
@@ -349,7 +350,7 @@ describe( 'Link', () => {
 
 				linkFeature._showPanel();
 
-				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition', () => {} );
+				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 				const spyHide = testUtils.sinon.spy( linkFeature, '_hidePanel' );
 
 				const root = viewDocument.getRoot();
@@ -431,7 +432,7 @@ describe( 'Link', () => {
 		} );
 
 		it( 'should show the #_balloon on execute event with the selected #formView', () => {
-			const spy = testUtils.sinon.stub( linkFeature, '_showPanel', () => {} );
+			const spy = testUtils.sinon.stub( linkFeature, '_showPanel' ).returns( {} );
 
 			linkButton.fire( 'execute' );
 			sinon.assert.calledWithExactly( spy, true );
@@ -465,7 +466,7 @@ describe( 'Link', () => {
 
 	describe( 'keyboard support', () => {
 		it( 'should show the #_balloon with selected #formView on Ctrl+K keystroke', () => {
-			const spy = testUtils.sinon.stub( linkFeature, '_showPanel', () => {} );
+			const spy = testUtils.sinon.stub( linkFeature, '_showPanel' ).returns( {} );
 			const command = editor.commands.get( 'link' );
 
 			command.isEnabled = false;
@@ -589,7 +590,7 @@ describe( 'Link', () => {
 				observer = editor.editing.view.getObserver( ClickObserver );
 				editor.document.schema.allow( { name: '$text', inside: '$root' } );
 
-				spy = testUtils.sinon.stub( linkFeature, '_showPanel', () => {} );
+				spy = testUtils.sinon.stub( linkFeature, '_showPanel' ).returns( {} );
 			} );
 
 			it( 'should open with not selected formView when collapsed selection is inside link element', () => {

+ 2 - 2
packages/ckeditor5-link/tests/linkcommand.js

@@ -151,8 +151,8 @@ describe( 'LinkCommand', () => {
 				expect( command.value ).to.equal( 'url' );
 			} );
 
-			it(
-				'should overwrite `linkHref` attribute of selected text only, when selection start inside text with `linkHref` attribute',
+			it( 'should overwrite `linkHref` attribute of selected text only, ' +
+				'when selection start inside text with `linkHref` attribute',
 			() => {
 				setData( document, 'f<$text linkHref="other url">o[o</$text>ba]r' );
 

+ 4 - 1
packages/ckeditor5-link/tests/linkengine.js

@@ -19,7 +19,10 @@ describe( 'LinkEngine', () => {
 	let editor, doc;
 
 	beforeEach( () => {
-		return VirtualTestEditor.create( { plugins: [ Paragraph, LinkEngine ] } )
+		return VirtualTestEditor
+			.create( {
+				plugins: [ Paragraph, LinkEngine ]
+			} )
 			.then( newEditor => {
 				editor = newEditor;
 

+ 11 - 10
packages/ckeditor5-link/tests/manual/link.js

@@ -12,13 +12,14 @@ import Link from '../../src/link';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Link, Typing, Paragraph, Undo, Enter ],
-	toolbar: [ 'link', 'unlink', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Link, Typing, Paragraph, Undo, Enter ],
+		toolbar: [ 'link', 'unlink', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 28 - 26
packages/ckeditor5-link/tests/manual/tickets/113/1.js

@@ -14,34 +14,36 @@ import Position from '@ckeditor/ckeditor5-engine/src/model/position';
 import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 
 // Editor for the external insert.
-ClassicEditor.create( document.querySelector( '#editor-insert' ), {
-	plugins: [ ArticlePresets ],
-	toolbar: [ 'undo', 'redo', 'link' ]
-} )
-.then( editor => {
-	const element = document.querySelector( '#button-insert' );
-
-	element.addEventListener( 'click', () => {
-		element.disabled = true;
-		startExternalInsert( editor );
-	} );
-} )
-.catch( err => console.error( err.stack ) );
+ClassicEditor
+	.create( document.querySelector( '#editor-insert' ), {
+		plugins: [ ArticlePresets ],
+		toolbar: [ 'undo', 'redo', 'link' ]
+	} )
+	.then( editor => {
+		const element = document.querySelector( '#button-insert' );
+
+		element.addEventListener( 'click', () => {
+			element.disabled = true;
+			startExternalInsert( editor );
+		} );
+	} )
+	.catch( err => console.error( err.stack ) );
 
 // Editor for the external delete.
-ClassicEditor.create( document.querySelector( '#editor-delete' ), {
-	plugins: [ ArticlePresets ],
-	toolbar: [ 'undo', 'redo', 'link' ]
-} )
-.then( editor => {
-	const element = document.querySelector( '#button-delete' );
-
-	element.addEventListener( 'click', () => {
-		element.disabled = true;
-		startExternalDelete( editor );
-	} );
-} )
-.catch( err => console.error( err.stack ) );
+ClassicEditor
+	.create( document.querySelector( '#editor-delete' ), {
+		plugins: [ ArticlePresets ],
+		toolbar: [ 'undo', 'redo', 'link' ]
+	} )
+	.then( editor => {
+		const element = document.querySelector( '#button-delete' );
+
+		element.addEventListener( 'click', () => {
+			element.disabled = true;
+			startExternalDelete( editor );
+		} );
+	} )
+	.catch( err => console.error( err.stack ) );
 
 function wait( delay ) {
 	return new Promise( resolve => {

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

@@ -101,7 +101,7 @@ describe( 'LinkFormView', () => {
 
 		describe( 'url input view', () => {
 			it( 'has placeholder', () => {
-				expect( view.urlInputView.inputView.placeholder ).to.equal( 'http://example.com' );
+				expect( view.urlInputView.inputView.placeholder ).to.equal( 'https://example.com' );
 			} );
 		} );
 

+ 2 - 3
packages/ckeditor5-link/tests/unlinkcommand.js

@@ -140,9 +140,8 @@ describe( 'UnlinkCommand', () => {
 					);
 			} );
 
-			it(
-				'should remove `linkHref` attribute from selection siblings with the same attribute value and do nothing with other ' +
-				'attributes',
+			it( 'should remove `linkHref` attribute from selection siblings with the same attribute value ' +
+				'and do nothing with other attributes',
 			() => {
 				setData(
 					document,