8
0
Pārlūkot izejas kodu

Tests: Use sample file for automated tests. See ckeditor/ckeditor5-dev#139.

Maciej Gołaszewski 6 gadi atpakaļ
vecāks
revīzija
80ee03ed59

+ 10 - 10
packages/ckeditor5-image/tests/image.js

@@ -63,11 +63,11 @@ describe( 'Image', () => {
 
 	describe( 'selection', () => {
 		it( 'should create fake selection', () => {
-			setModelData( model, '[<image alt="alt text" src="foo.png"></image>]' );
+			setModelData( model, '[<image alt="alt text" src="/assets/sample.png"></image>]' );
 
 			expect( getViewData( view ) ).to.equal(
 				'[<figure class="ck-widget ck-widget_selected image" contenteditable="false">' +
-					'<img alt="alt text" src="foo.png"></img>' +
+					'<img alt="alt text" src="/assets/sample.png"></img>' +
 				'</figure>]'
 			);
 
@@ -76,11 +76,11 @@ describe( 'Image', () => {
 		} );
 
 		it( 'should create proper fake selection label when alt attribute is empty', () => {
-			setModelData( model, '[<image src="foo.png" alt=""></image>]' );
+			setModelData( model, '[<image src="/assets/sample.png" alt=""></image>]' );
 
 			expect( getViewData( view ) ).to.equal(
 				'[<figure class="ck-widget ck-widget_selected image" contenteditable="false">' +
-				'<img alt="" src="foo.png"></img>' +
+				'<img alt="" src="/assets/sample.png"></img>' +
 				'</figure>]'
 			);
 
@@ -90,16 +90,16 @@ describe( 'Image', () => {
 
 		it( 'should remove selected class from previously selected element', () => {
 			setModelData( model,
-				'[<image src="foo.png" alt="alt text"></image>]' +
-				'<image src="foo.png" alt="alt text"></image>'
+				'[<image src="/assets/sample.png" alt="alt text"></image>]' +
+				'<image src="/assets/sample.png" alt="alt text"></image>'
 			);
 
 			expect( getViewData( view ) ).to.equal(
 				'[<figure class="ck-widget ck-widget_selected image" contenteditable="false">' +
-				'<img alt="alt text" src="foo.png"></img>' +
+				'<img alt="alt text" src="/assets/sample.png"></img>' +
 				'</figure>]' +
 				'<figure class="ck-widget image" contenteditable="false">' +
-				'<img alt="alt text" src="foo.png"></img>' +
+				'<img alt="alt text" src="/assets/sample.png"></img>' +
 				'</figure>'
 			);
 
@@ -110,10 +110,10 @@ describe( 'Image', () => {
 
 			expect( getViewData( view ) ).to.equal(
 				'<figure class="ck-widget image" contenteditable="false">' +
-				'<img alt="alt text" src="foo.png"></img>' +
+				'<img alt="alt text" src="/assets/sample.png"></img>' +
 				'</figure>' +
 				'[<figure class="ck-widget ck-widget_selected image" contenteditable="false">' +
-				'<img alt="alt text" src="foo.png"></img>' +
+				'<img alt="alt text" src="/assets/sample.png"></img>' +
 				'</figure>]'
 			);
 		} );

+ 8 - 8
packages/ckeditor5-image/tests/image/converters.js

@@ -88,9 +88,9 @@ describe( 'Image converters', () => {
 		} );
 
 		it( 'should find img element among children and convert it using already defined converters', () => {
-			editor.setData( '<figure class="image"><img src="foo.png" /></figure>' );
+			editor.setData( '<figure class="image"><img src="/assets/sample.png" /></figure>' );
 
-			expectModel( '<image src="foo.png"></image>' );
+			expectModel( '<image src="/assets/sample.png"></image>' );
 			expect( imgConverterCalled ).to.be.true;
 		} );
 
@@ -102,10 +102,10 @@ describe( 'Image converters', () => {
 			// Is allowed in root, but should not try to split image element.
 			schema.register( 'bar', { allowIn: '$root' } );
 
-			editor.setData( '<figure class="image">x<img src="foo.png" />y<foo></foo><bar></bar></figure>' );
+			editor.setData( '<figure class="image">x<img src="/assets/sample.png" />y<foo></foo><bar></bar></figure>' );
 
 			// Element bar not converted because schema does not allow it.
-			expectModel( '<image src="foo.png">xy<foo></foo></image>' );
+			expectModel( '<image src="/assets/sample.png">xy<foo></foo></image>' );
 		} );
 
 		it( 'should split parent element when image is not allowed - in the middle', () => {
@@ -178,18 +178,18 @@ describe( 'Image converters', () => {
 				data.modelCursor = data.modelRange.end;
 			}, { priority: 'high' } );
 
-			editor.setData( '<figure class="image"><img src="foo.png" />xyz</figure>' );
+			editor.setData( '<figure class="image"><img src="/assets/sample.png" />xyz</figure>' );
 
-			expectModel( '<myImage data="{"src":"foo.png"}"></myImage>' );
+			expectModel( '<myImage data="{"src":"/assets/sample.png"}"></myImage>' );
 		} );
 
 		// Test exactly what figure converter does, which is putting it's children element to image element.
 		// If this has not been done, it means that figure converter was not used.
 		it( 'should not convert if figure do not have class="image" attribute', () => {
-			editor.setData( '<figure><img src="foo.png" />xyz</figure>' );
+			editor.setData( '<figure><img src="/assets/sample.png" />xyz</figure>' );
 
 			// Default image converter will be fired.
-			expectModel( '<image src="foo.png"></image>' );
+			expectModel( '<image src="/assets/sample.png"></image>' );
 		} );
 
 		it( 'should not convert if there is no img element among children', () => {

+ 61 - 50
packages/ckeditor5-image/tests/image/imageediting.js

@@ -71,7 +71,7 @@ describe( 'ImageEditing', () => {
 		ClassicTestEditor.create( element, {
 			plugins: [ ImageEditing ]
 		} ).then( editor => {
-			editor.data.set( '<figure class="image"><img src="foo.png" alt="bar" /></figure>' );
+			editor.data.set( '<figure class="image"><img src="/assets/sample.png" alt="bar" /></figure>' );
 
 			const spy = sinon.spy();
 
@@ -88,25 +88,25 @@ describe( 'ImageEditing', () => {
 	describe( 'conversion in data pipeline', () => {
 		describe( 'model to view', () => {
 			it( 'should convert', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 
-				expect( editor.getData() ).to.equal( '<figure class="image"><img alt="alt text" src="foo.png"></figure>' );
+				expect( editor.getData() ).to.equal( '<figure class="image"><img alt="alt text" src="/assets/sample.png"></figure>' );
 			} );
 
 			it( 'should convert without alt attribute', () => {
-				setModelData( model, '<image src="foo.png"></image>' );
+				setModelData( model, '<image src="/assets/sample.png"></image>' );
 
-				expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+				expect( editor.getData() ).to.equal( '<figure class="image"><img src="/assets/sample.png"></figure>' );
 			} );
 
 			it( 'should convert srcset attribute to srcset and sizes attribute', () => {
 				setModelData( model,
-					'<image src="foo.png" alt="alt text" srcset=\'{ "data": "small.png 148w, big.png 1024w" }\'></image>'
+					'<image src="/assets/sample.png" alt="alt text" srcset=\'{ "data": "small.png 148w, big.png 1024w" }\'></image>'
 				);
 
 				expect( normalizeHtml( editor.getData() ) ).to.equal(
 					'<figure class="image">' +
-						'<img alt="alt text" sizes="100vw" src="foo.png" srcset="small.png 148w, big.png 1024w"></img>' +
+						'<img alt="alt text" sizes="100vw" src="/assets/sample.png" srcset="small.png 148w, big.png 1024w"></img>' +
 					'</figure>'
 				);
 			} );
@@ -114,17 +114,19 @@ describe( 'ImageEditing', () => {
 			it( 'should convert srcset attribute to width, srcset and add sizes attribute', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "data": "small.png 148w, big.png 1024w", "width": "1024" }\'>' +
 					'</image>'
 				);
 
+				/* eslint-disable max-len */
 				expect( normalizeHtml( editor.getData() ) ).to.equal(
 					'<figure class="image">' +
-						'<img alt="alt text" sizes="100vw" src="foo.png" srcset="small.png 148w, big.png 1024w" width="1024"></img>' +
+						'<img alt="alt text" sizes="100vw" src="/assets/sample.png" srcset="small.png 148w, big.png 1024w" width="1024"></img>' +
 					'</figure>'
 				);
+				/* eslint-enable max-len */
 			} );
 
 			it( 'should not convert srcset attribute if is already consumed', () => {
@@ -136,7 +138,7 @@ describe( 'ImageEditing', () => {
 
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "data": "small.png 148w, big.png 1024w", "width": "1024" }\'>' +
 					'</image>'
@@ -144,7 +146,7 @@ describe( 'ImageEditing', () => {
 
 				expect( editor.getData() ).to.equal(
 					'<figure class="image">' +
-						'<img alt="alt text" src="foo.png">' +
+						'<img alt="alt text" src="/assets/sample.png">' +
 					'</figure>'
 				);
 			} );
@@ -152,7 +154,7 @@ describe( 'ImageEditing', () => {
 			it( 'should not convert srcset attribute if has wrong data', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "foo":"bar" }\'>' +
 					'</image>' );
@@ -164,7 +166,7 @@ describe( 'ImageEditing', () => {
 
 				expect( editor.getData() ).to.equal(
 					'<figure class="image">' +
-						'<img alt="alt text" src="foo.png">' +
+						'<img alt="alt text" src="/assets/sample.png">' +
 					'</figure>'
 				);
 			} );
@@ -172,10 +174,10 @@ describe( 'ImageEditing', () => {
 
 		describe( 'view to model', () => {
 			it( 'should convert image figure', () => {
-				editor.setData( '<figure class="image"><img src="foo.png" alt="alt text" /></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" alt="alt text" /></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image alt="alt text" src="foo.png"></image>' );
+					.to.equal( '<image alt="alt text" src="/assets/sample.png"></image>' );
 			} );
 
 			it( 'should not convert if there is no image class', () => {
@@ -200,10 +202,10 @@ describe( 'ImageEditing', () => {
 			} );
 
 			it( 'should convert without alt attribute', () => {
-				editor.setData( '<figure class="image"><img src="foo.png" /></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" /></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image src="foo.png"></image>' );
+					.to.equal( '<image src="/assets/sample.png"></image>' );
 			} );
 
 			it( 'should not convert without src attribute', () => {
@@ -223,7 +225,7 @@ describe( 'ImageEditing', () => {
 
 				editor.conversion.elementToElement( { model: 'div', view: 'div' } );
 
-				editor.setData( '<div><figure class="image"><img src="foo.png" alt="alt text" /></figure></div>' );
+				editor.setData( '<div><figure class="image"><img src="/assets/sample.png" alt="alt text" /></figure></div>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
 					.to.equal( '<div></div>' );
@@ -235,7 +237,7 @@ describe( 'ImageEditing', () => {
 					conversionApi.consumable.consume( img, { name: true } );
 				}, { priority: 'high' } );
 
-				editor.setData( '<figure class="image"><img src="foo.png" alt="alt text" /></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" alt="alt text" /></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
 					.to.equal( '' );
@@ -246,7 +248,7 @@ describe( 'ImageEditing', () => {
 					conversionApi.consumable.consume( data.viewItem, { name: true, class: 'image' } );
 				}, { priority: 'high' } );
 
-				editor.setData( '<figure class="image"><img src="foo.png" alt="alt text" /></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" alt="alt text" /></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
 					.to.equal( '' );
@@ -256,16 +258,16 @@ describe( 'ImageEditing', () => {
 				const conversionSpy = sinon.spy();
 				editor.data.upcastDispatcher.on( 'element:figcaption', conversionSpy );
 
-				editor.setData( '<figure class="image"><img src="foo.png" alt="alt text" /><figcaption></figcaption></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" alt="alt text" /><figcaption></figcaption></figure>' );
 
 				sinon.assert.calledOnce( conversionSpy );
 			} );
 
 			it( 'should convert bare img element', () => {
-				editor.setData( '<img src="foo.png" alt="alt text" />' );
+				editor.setData( '<img src="/assets/sample.png" alt="alt text" />' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image alt="alt text" src="foo.png"></image>' );
+					.to.equal( '<image alt="alt text" src="/assets/sample.png"></image>' );
 			} );
 
 			it( 'should not convert alt attribute on non-img element', () => {
@@ -284,34 +286,41 @@ describe( 'ImageEditing', () => {
 			it( 'should convert image with srcset attribute', () => {
 				editor.setData(
 					'<figure class="image">' +
-						'<img src="foo.png" alt="alt text" srcset="small.png 148w, big.png 1024w" />' +
+						'<img src="/assets/sample.png" alt="alt text" srcset="small.png 148w, big.png 1024w" />' +
 					'</figure>'
 				);
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image alt="alt text" src="foo.png" srcset="{"data":"small.png 148w, big.png 1024w"}"></image>' );
+					.to.equal(
+						'<image alt="alt text" src="/assets/sample.png" srcset="{"data":"small.png 148w, big.png 1024w"}"></image>'
+					);
 			} );
 
 			it( 'should convert image with srcset and width attributes', () => {
 				editor.setData(
 					'<figure class="image">' +
-					'<img src="foo.png" alt="alt text" srcset="small.png 148w, big.png 1024w" width="1024" />' +
+					'<img src="/assets/sample.png" alt="alt text" srcset="small.png 148w, big.png 1024w" width="1024" />' +
 					'</figure>'
 				);
 
+				/* eslint-disable max-len */
 				expect( getModelData( model, { withoutSelection: true } ) ).to.equal(
-					'<image alt="alt text" src="foo.png" srcset="{"data":"small.png 148w, big.png 1024w","width":"1024"}"></image>' );
+					'<image alt="alt text" src="/assets/sample.png" srcset="{"data":"small.png 148w, big.png 1024w","width":"1024"}"></image>'
+				);
+				/* eslint-enable max-len */
 			} );
 
 			it( 'should ignore sizes attribute', () => {
 				editor.setData(
 					'<figure class="image">' +
-						'<img src="foo.png" alt="alt text" srcset="small.png 148w, big.png 1024w" sizes="50vw" />' +
+						'<img src="/assets/sample.png" alt="alt text" srcset="small.png 148w, big.png 1024w" sizes="50vw" />' +
 					'</figure>'
 				);
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image alt="alt text" src="foo.png" srcset="{"data":"small.png 148w, big.png 1024w"}"></image>' );
+					.to.equal(
+						'<image alt="alt text" src="/assets/sample.png" srcset="{"data":"small.png 148w, big.png 1024w"}"></image>'
+					);
 			} );
 
 			describe( 'should autohoist images', () => {
@@ -420,15 +429,15 @@ describe( 'ImageEditing', () => {
 	describe( 'conversion in editing pipeline', () => {
 		describe( 'model to view', () => {
 			it( 'should convert', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
-					'<figure class="ck-widget image" contenteditable="false"><img alt="alt text" src="foo.png"></img></figure>'
+					'<figure class="ck-widget image" contenteditable="false"><img alt="alt text" src="/assets/sample.png"></img></figure>'
 				);
 			} );
 
 			it( 'converted element should be widgetized', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 				const figure = viewDocument.getRoot().getChild( 0 );
 
 				expect( figure.name ).to.equal( 'figure' );
@@ -436,7 +445,7 @@ describe( 'ImageEditing', () => {
 			} );
 
 			it( 'should convert attribute change', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 				const image = doc.getRoot().getChild( 0 );
 
 				model.change( writer => {
@@ -444,12 +453,12 @@ describe( 'ImageEditing', () => {
 				} );
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
-					'<figure class="ck-widget image" contenteditable="false"><img alt="new text" src="foo.png"></img></figure>'
+					'<figure class="ck-widget image" contenteditable="false"><img alt="new text" src="/assets/sample.png"></img></figure>'
 				);
 			} );
 
 			it( 'should convert attribute removal', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 				const image = doc.getRoot().getChild( 0 );
 
 				model.change( writer => {
@@ -457,11 +466,11 @@ describe( 'ImageEditing', () => {
 				} );
 
 				expect( getViewData( view, { withoutSelection: true } ) )
-					.to.equal( '<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>' );
+					.to.equal( '<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>' );
 			} );
 
 			it( 'should not convert change if is already consumed', () => {
-				setModelData( model, '<image src="foo.png" alt="alt text"></image>' );
+				setModelData( model, '<image src="/assets/sample.png" alt="alt text"></image>' );
 				const image = doc.getRoot().getChild( 0 );
 
 				editor.editing.downcastDispatcher.on( 'attribute:alt:image', ( evt, data, conversionApi ) => {
@@ -473,21 +482,21 @@ describe( 'ImageEditing', () => {
 				} );
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
-					'<figure class="ck-widget image" contenteditable="false"><img alt="alt text" src="foo.png"></img></figure>'
+					'<figure class="ck-widget image" contenteditable="false"><img alt="alt text" src="/assets/sample.png"></img></figure>'
 				);
 			} );
 
 			it( 'should convert srcset attribute to srcset and sizes', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "data":"small.png 148w, big.png 1024w" }\'>' +
 					'</image>' );
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-						'<img alt="alt text" sizes="100vw" src="foo.png" srcset="small.png 148w, big.png 1024w"></img>' +
+						'<img alt="alt text" sizes="100vw" src="/assets/sample.png" srcset="small.png 148w, big.png 1024w"></img>' +
 					'</figure>'
 				);
 			} );
@@ -495,7 +504,7 @@ describe( 'ImageEditing', () => {
 			it( 'should not convert srcset attribute if has wrong data', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "foo":"bar" }\'>' +
 					'</image>' );
@@ -507,7 +516,7 @@ describe( 'ImageEditing', () => {
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-						'<img alt="alt text" src="foo.png"></img>' +
+						'<img alt="alt text" src="/assets/sample.png"></img>' +
 					'</figure>'
 				);
 			} );
@@ -515,20 +524,22 @@ describe( 'ImageEditing', () => {
 			it( 'should convert srcset attribute to srcset, width and sizes', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "data":"small.png 148w, big.png 1024w", "width":"1024" }\'>' +
 					'</image>' );
 
+				/* eslint-disable max-len */
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-						'<img alt="alt text" sizes="100vw" src="foo.png" srcset="small.png 148w, big.png 1024w" width="1024"></img>' +
+						'<img alt="alt text" sizes="100vw" src="/assets/sample.png" srcset="small.png 148w, big.png 1024w" width="1024"></img>' +
 					'</figure>'
 				);
+				/* eslint-enable max-len */
 			} );
 
 			it( 'should remove sizes and srcsset attribute when srcset attribute is removed from model', () => {
-				setModelData( model, '<image src="foo.png" srcset=\'{ "data": "small.png 148w, big.png 1024w" }\'></image>' );
+				setModelData( model, '<image src="/assets/sample.png" srcset=\'{ "data": "small.png 148w, big.png 1024w" }\'></image>' );
 				const image = doc.getRoot().getChild( 0 );
 
 				model.change( writer => {
@@ -537,7 +548,7 @@ describe( 'ImageEditing', () => {
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-						'<img src="foo.png"></img>' +
+						'<img src="/assets/sample.png"></img>' +
 					'</figure>'
 				);
 			} );
@@ -545,7 +556,7 @@ describe( 'ImageEditing', () => {
 			it( 'should remove width, sizes and srcsset attribute when srcset attribute is removed from model', () => {
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'srcset=\'{ "data": "small.png 148w, big.png 1024w", "width": "1024" }\'>' +
 					'</image>'
 				);
@@ -557,7 +568,7 @@ describe( 'ImageEditing', () => {
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-					'<img src="foo.png"></img>' +
+					'<img src="/assets/sample.png"></img>' +
 					'</figure>'
 				);
 			} );
@@ -571,7 +582,7 @@ describe( 'ImageEditing', () => {
 
 				setModelData( model,
 					'<image ' +
-						'src="foo.png" ' +
+						'src="/assets/sample.png" ' +
 						'alt="alt text" ' +
 						'srcset=\'{ "data": "small.png 148w, big.png 1024w", "width": "1024" }\'>' +
 					'</image>'
@@ -579,7 +590,7 @@ describe( 'ImageEditing', () => {
 
 				expect( getViewData( view, { withoutSelection: true } ) ).to.equal(
 					'<figure class="ck-widget image" contenteditable="false">' +
-						'<img alt="alt text" src="foo.png"></img>' +
+						'<img alt="alt text" src="/assets/sample.png"></img>' +
 					'</figure>'
 				);
 			} );

+ 7 - 4
packages/ckeditor5-image/tests/image/imageloadobserver.js

@@ -37,7 +37,7 @@ describe( 'ImageLoadObserver', () => {
 
 		viewDocument.on( 'imageLoaded', spy );
 
-		setData( view, '<img src="foo.png" />' );
+		setData( view, '<img src="/assets/sample.png" />' );
 
 		sinon.assert.notCalled( spy );
 
@@ -79,7 +79,7 @@ describe( 'ImageLoadObserver', () => {
 
 		viewDocument.on( 'imageLoaded', spy );
 
-		setData( view, '<img src="foo.png" />' );
+		setData( view, '<img src="/assets/sample.png" />' );
 
 		sinon.assert.notCalled( spy );
 
@@ -93,7 +93,10 @@ describe( 'ImageLoadObserver', () => {
 	} );
 
 	it( 'should do nothing with an image when changes are in the other parent', () => {
-		setData( view, '<container:p><attribute:b>foo</attribute:b></container:p><container:div><img src="foo.png" /></container:div>' );
+		setData(
+			view,
+			'<container:p><attribute:b>foo</attribute:b></container:p><container:div><img src="/assets/sample.png" /></container:div>'
+		);
 
 		const viewP = viewRoot.getChild( 0 );
 		const viewDiv = viewRoot.getChild( 1 );
@@ -133,7 +136,7 @@ describe( 'ImageLoadObserver', () => {
 
 		viewDocument.on( 'imageLoaded', spy );
 
-		setData( view, '<img src="foo.png" />' );
+		setData( view, '<img src="/assets/sample.png" />' );
 
 		observer.destroy();
 

+ 4 - 4
packages/ckeditor5-image/tests/imagecaption/imagecaption-integration.js

@@ -50,7 +50,7 @@ describe( 'ImageCaption integration', () => {
 		it( 'does nothing if soft enter was pressed', () => {
 			setModelData(
 				model,
-				'<paragraph>Foo.</paragraph><image src="foo.png"><caption>Foo.[]</caption></image><paragraph>Bar.</paragraph>'
+				'<paragraph>Foo.</paragraph><image src="/assets/sample.png"><caption>Foo.[]</caption></image><paragraph>Bar.</paragraph>'
 			);
 
 			const domEvent = new DomEventData( viewDocument, getDomEvent(), { isSoft: true } );
@@ -63,7 +63,7 @@ describe( 'ImageCaption integration', () => {
 
 			assertModelData(
 				'<paragraph>Foo.</paragraph>' +
-				'<image src="foo.png">' +
+				'<image src="/assets/sample.png">' +
 					'<caption>Foo.[]</caption>' +
 				'</image>' +
 				'<paragraph>Bar.</paragraph>'
@@ -94,7 +94,7 @@ describe( 'ImageCaption integration', () => {
 		it( 'inserts a soft break when soft enter was pressed', () => {
 			setModelData(
 				model,
-				'<paragraph>Foo.</paragraph><image src="foo.png"><caption>Foo.[]</caption></image><paragraph>Bar.</paragraph>'
+				'<paragraph>Foo.</paragraph><image src="/assets/sample.png"><caption>Foo.[]</caption></image><paragraph>Bar.</paragraph>'
 			);
 
 			const domEvent = new DomEventData( viewDocument, getDomEvent(), { isSoft: true } );
@@ -108,7 +108,7 @@ describe( 'ImageCaption integration', () => {
 
 			assertModelData(
 				'<paragraph>Foo.</paragraph>' +
-					'<image src="foo.png">' +
+					'<image src="/assets/sample.png">' +
 						'<caption>Foo.<softBreak></softBreak>[]</caption>' +
 					'</image>' +
 				'<paragraph>Bar.</paragraph>'

+ 8 - 6
packages/ckeditor5-image/tests/imagecaption/imagecaptionediting.js

@@ -64,17 +64,17 @@ describe( 'ImageCaptionEditing', () => {
 	describe( 'data pipeline', () => {
 		describe( 'view to model', () => {
 			it( 'should convert figcaption inside image figure', () => {
-				editor.setData( '<figure class="image"><img src="foo.png" /><figcaption>foo bar</figcaption></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" /><figcaption>foo bar</figcaption></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image src="foo.png"><caption>foo bar</caption></image>' );
+					.to.equal( '<image src="/assets/sample.png"><caption>foo bar</caption></image>' );
 			} );
 
 			it( 'should add empty caption if there is no figcaption', () => {
-				editor.setData( '<figure class="image"><img src="foo.png" /></figure>' );
+				editor.setData( '<figure class="image"><img src="/assets/sample.png" /></figure>' );
 
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<image src="foo.png"><caption></caption></image>' );
+					.to.equal( '<image src="/assets/sample.png"><caption></caption></image>' );
 			} );
 
 			it( 'should not convert figcaption inside other elements than image', () => {
@@ -563,12 +563,14 @@ describe( 'ImageCaptionEditing', () => {
 				setModelData( model, '<paragraph>foo[]</paragraph>' );
 
 				model.change( writer => {
-					const image = writer.createElement( 'image', { src: '/foo.png' } );
+					const image = writer.createElement( 'image', { src: '/assets/sample.png' } );
 
 					writer.insert( image, doc.getRoot() );
 				} );
 
-				expect( getModelData( model ) ).to.equal( '<image src="/foo.png"><caption></caption></image><paragraph>foo[]</paragraph>' );
+				expect( getModelData( model ) ).to.equal(
+					'<image src="/assets/sample.png"><caption></caption></image><paragraph>foo[]</paragraph>'
+				);
 
 				editor.execute( 'undo' );
 

+ 33 - 33
packages/ckeditor5-image/tests/imagestyle/imagestyleediting.js

@@ -88,23 +88,23 @@ describe( 'ImageStyleEditing', () => {
 		} );
 
 		it( 'should convert from view to model', () => {
-			editor.setData( '<figure class="image side-class"><img src="foo.png" /></figure>' );
+			editor.setData( '<figure class="image side-class"><img src="/assets/sample.png" /></figure>' );
 
 			expect( getModelData( model, { withoutSelection: true } ) )
-				.to.equal( '<image imageStyle="sideStyle" src="foo.png"></image>' );
+				.to.equal( '<image imageStyle="sideStyle" src="/assets/sample.png"></image>' );
 
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
 				'<figure class="ck-widget image side-class" contenteditable="false">' +
-					'<img src="foo.png"></img>' +
+					'<img src="/assets/sample.png"></img>' +
 				'</figure>' );
 		} );
 
 		it( 'should not convert from view to model if class is not defined', () => {
-			editor.setData( '<figure class="image foo-bar"><img src="foo.png" /></figure>' );
+			editor.setData( '<figure class="image foo-bar"><img src="/assets/sample.png" /></figure>' );
 
-			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<image src="foo.png"></image>' );
+			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<image src="/assets/sample.png"></image>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
@@ -122,66 +122,66 @@ describe( 'ImageStyleEditing', () => {
 				}
 			} );
 
-			editor.setData( '<figure class="image side-class"><img src="foo.png" /></figure>' );
+			editor.setData( '<figure class="image side-class"><img src="/assets/sample.png" /></figure>' );
 
-			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<image src="foo.png"></image>' );
+			expect( getModelData( model, { withoutSelection: true } ) ).to.equal( '<image src="/assets/sample.png"></image>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should convert model to view: adding attribute', () => {
-			setModelData( model, '<image src="foo.png"></image>' );
+			setModelData( model, '<image src="/assets/sample.png"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', 'sideStyle', image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image side-class"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image side-class"><img src="/assets/sample.png"></figure>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image side-class" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image side-class" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should convert model to view: removing attribute', () => {
-			setModelData( model, '<image src="foo.png" imageStyle="sideStyle"></image>' );
+			setModelData( model, '<image src="/assets/sample.png" imageStyle="sideStyle"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', null, image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image"><img src="/assets/sample.png"></figure>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should convert model to view: change attribute', () => {
-			setModelData( model, '<image src="foo.png" imageStyle="dummy"></image>' );
+			setModelData( model, '<image src="/assets/sample.png" imageStyle="dummy"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', 'sideStyle', image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image side-class"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image side-class"><img src="/assets/sample.png"></figure>' );
 
 			// https://github.com/ckeditor/ckeditor5-image/issues/132
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image side-class" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image side-class" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', 'dummyStyle', image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image dummy-class"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image dummy-class"><img src="/assets/sample.png"></figure>' );
 
 			// https://github.com/ckeditor/ckeditor5-image/issues/132
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget dummy-class image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget dummy-class image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
@@ -190,7 +190,7 @@ describe( 'ImageStyleEditing', () => {
 				conversionApi.consumable.consume( data.item, 'attribute:imageStyle' );
 			}, { priority: 'high' } );
 
-			setModelData( model, '<image src="foo.png"></image>' );
+			setModelData( model, '<image src="/assets/sample.png"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
@@ -198,7 +198,7 @@ describe( 'ImageStyleEditing', () => {
 			} );
 
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
@@ -207,52 +207,52 @@ describe( 'ImageStyleEditing', () => {
 				conversionApi.consumable.consume( data.item, 'attribute:imageStyle' );
 			}, { priority: 'high' } );
 
-			setModelData( model, '<image src="foo.png" imageStyle="dummyStyle"></image>' );
+			setModelData( model, '<image src="/assets/sample.png" imageStyle="dummyStyle"></image>' );
 
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should not convert from model to view if style is not present: adding attribute', () => {
-			setModelData( model, '<image src="foo.png"></image>' );
+			setModelData( model, '<image src="/assets/sample.png"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', 'foo', image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image"><img src="/assets/sample.png"></figure>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should not convert from model to view if style is not present: change attribute', () => {
-			setModelData( model, '<image src="foo.png" imageStyle="dummy"></image>' );
+			setModelData( model, '<image src="/assets/sample.png" imageStyle="dummy"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', 'foo', image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image"><img src="/assets/sample.png"></figure>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 
 		it( 'should not convert from model to view if style is not present: remove attribute', () => {
-			setModelData( model, '<image src="foo.png" imageStyle="foo"></image>' );
+			setModelData( model, '<image src="/assets/sample.png" imageStyle="foo"></image>' );
 			const image = document.getRoot().getChild( 0 );
 
 			model.change( writer => {
 				writer.setAttribute( 'imageStyle', null, image );
 			} );
 
-			expect( editor.getData() ).to.equal( '<figure class="image"><img src="foo.png"></figure>' );
+			expect( editor.getData() ).to.equal( '<figure class="image"><img src="/assets/sample.png"></figure>' );
 			expect( getViewData( viewDocument, { withoutSelection: true } ) ).to.equal(
-				'<figure class="ck-widget image" contenteditable="false"><img src="foo.png"></img></figure>'
+				'<figure class="ck-widget image" contenteditable="false"><img src="/assets/sample.png"></img></figure>'
 			);
 		} );
 	} );

+ 3 - 3
packages/ckeditor5-image/tests/integration.js

@@ -55,7 +55,7 @@ describe( 'ImageToolbar integration', () => {
 
 		it( 'should prevent the BalloonToolbar from being displayed when an image is selected', () => {
 			// When image is selected along with text.
-			setModelData( newEditor.model, '<paragraph>fo[o</paragraph><image alt="alt text" src="foo.png"></image>]' );
+			setModelData( newEditor.model, '<paragraph>fo[o</paragraph><image alt="alt text" src="/assets/sample.png"></image>]' );
 
 			balloonToolbar.show();
 
@@ -63,7 +63,7 @@ describe( 'ImageToolbar integration', () => {
 			expect( balloon.visibleView ).to.equal( balloonToolbar.toolbarView );
 
 			// When only image is selected.
-			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="foo.png"></image>]' );
+			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="/assets/sample.png"></image>]' );
 
 			balloonToolbar.show();
 
@@ -77,7 +77,7 @@ describe( 'ImageToolbar integration', () => {
 			const normalPrioritySpy = sinon.spy();
 
 			// Select an image
-			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="foo.png"></image>]' );
+			setModelData( newEditor.model, '<paragraph>foo</paragraph>[<image alt="alt text" src="/assets/sample.png"></image>]' );
 
 			newEditor.listenTo( balloonToolbar, 'show', highestPrioritySpy, { priority: 'highest' } );
 			newEditor.listenTo( balloonToolbar, 'show', highPrioritySpy, { priority: 'high' } );