Przeglądaj źródła

Merge branch 'master' into i/6091

Maciej Gołaszewski 5 lat temu
rodzic
commit
62bc67e337
26 zmienionych plików z 465 dodań i 443 usunięć
  1. 27 9
      packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md
  2. 51 47
      packages/ckeditor5-engine/tests/conversion/conversion.js
  3. 1 1
      packages/ckeditor5-engine/tests/conversion/downcastdispatcher.js
  4. 24 24
      packages/ckeditor5-engine/tests/conversion/downcasthelpers.js
  5. 2 2
      packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js
  6. 11 11
      packages/ckeditor5-engine/tests/dev-utils/model.js
  7. 2 2
      packages/ckeditor5-engine/tests/model/differ.js
  8. 8 8
      packages/ckeditor5-engine/tests/model/position.js
  9. 4 4
      packages/ckeditor5-engine/tests/model/utils/insertcontent.js
  10. 5 5
      packages/ckeditor5-engine/tests/model/writer.js
  11. 15 15
      packages/ckeditor5-engine/tests/utils/bindtwostepcarettoattribute.js
  12. 128 128
      packages/ckeditor5-engine/tests/view/domconverter/view-to-dom.js
  13. 22 22
      packages/ckeditor5-engine/tests/view/downcastwriter/breakattributes.js
  14. 4 4
      packages/ckeditor5-engine/tests/view/downcastwriter/breakcontainer.js
  15. 13 13
      packages/ckeditor5-engine/tests/view/downcastwriter/clear.js
  16. 15 15
      packages/ckeditor5-engine/tests/view/downcastwriter/insert.js
  17. 15 15
      packages/ckeditor5-engine/tests/view/downcastwriter/mergeattributes.js
  18. 4 4
      packages/ckeditor5-engine/tests/view/downcastwriter/mergecontainers.js
  19. 11 11
      packages/ckeditor5-engine/tests/view/downcastwriter/move.js
  20. 17 17
      packages/ckeditor5-engine/tests/view/downcastwriter/remove.js
  21. 30 30
      packages/ckeditor5-engine/tests/view/downcastwriter/unwrap.js
  22. 46 46
      packages/ckeditor5-engine/tests/view/downcastwriter/wrap.js
  23. 1 1
      packages/ckeditor5-engine/tests/view/filler.js
  24. 2 2
      packages/ckeditor5-engine/tests/view/observer/fakeselectionobserver.js
  25. 6 6
      packages/ckeditor5-engine/tests/view/position.js
  26. 1 1
      packages/ckeditor5-engine/tests/view/styles/utils.js

+ 27 - 9
packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md

@@ -330,7 +330,9 @@ function setupCustomClassConversion( viewElementName, modelElementName, editor )
 	editor.conversion.for( 'upcast' ).add( upcastCustomClasses( viewElementName ), { priority: 'low' } );
 
 	// Define downcast converters for a model element with a "low" priority so they are run after the default converters.
-	editor.conversion.for( 'downcast' ).add( downcastCustomClasses( modelElementName ), { priority: 'low' } );
+	// Use `downcastCustomClassesToFigure` if you'd like to keep your classes on <figure> element or `downcastCustomClassesToChild` if you'd like to keep your classes on a <figure> child element, i.e. <img>.
+	editor.conversion.for( 'downcast' ).add( downcastCustomClassesToFigure( modelElementName ), { priority: 'low' } );
+	// editor.conversion.for( 'downcast' ).add( downcastCustomClassesToChild( viewElementName, modelElementName ), { priority: 'low' } );
 }
 
 /**
@@ -375,11 +377,11 @@ function upcastCustomClasses( elementName ) {
 }
 
 /**
- * Creates a downcast converter that adds classes defined in the `customClass` attribute to a given view element.
+ * Creates a downcast converter that adds classes defined in the `customClass` attribute to a <figure> element.
  *
  * This converter expects that the view element is nested in a <figure> element.
  */
-function downcastCustomClasses( modelElementName ) {
+function downcastCustomClassesToFigure( modelElementName ) {
 	return dispatcher => dispatcher.on( `insert:${ modelElementName }`, ( evt, data, conversionApi ) => {
 		const modelElement = data.item;
 
@@ -389,14 +391,30 @@ function downcastCustomClasses( modelElementName ) {
 			return;
 		}
 
-		// The code below assumes that classes are set on the <figure> element...
+		// The code below assumes that classes are set on the <figure> element.
 		conversionApi.writer.addClass( modelElement.getAttribute( 'customClass' ), viewFigure );
+	} );
+}
+
+/**
+ * Creates a downcast converter that adds classes defined in the `customClass` attribute to a <figure> child element.
+ *
+ * This converter expects that the view element is nested in a <figure> element.
+ */
+function downcastCustomClassesToChild( viewElementName, modelElementName ) {
+	return dispatcher => dispatcher.on( `insert:${ modelElementName }`, ( evt, data, conversionApi ) => {
+		const modelElement = data.item;
+
+		const viewFigure = conversionApi.mapper.toViewElement( modelElement );
+
+		if ( !viewFigure ) {
+			return;
+		}
+
+		// The code below assumes that classes are set on the element inside the <figure>.
+		const viewElement = findViewChild( viewFigure, viewElementName, conversionApi );
 
-		// ... but if you prefer the classes to be passed to the <img> element, find the view element inside the <figure>:
-		//
-		// const viewElement = findViewChild( viewFigure, viewElementName, conversionApi );
-		//
-		// conversionApi.writer.addClass( modelElement.getAttribute( 'customClass' ), viewElement );
+		conversionApi.writer.addClass( modelElement.getAttribute( 'customClass' ), viewElement );
 	} );
 }
 

+ 51 - 47
packages/ckeditor5-engine/tests/conversion/conversion.js

@@ -155,15 +155,15 @@ describe( 'Conversion', () => {
 			it( 'config.view is a string', () => {
 				conversion.elementToElement( { model: 'paragraph', view: 'p' } );
 
-				test( '<p>Foo</p>', '<paragraph>Foo</paragraph>' );
+				testConversion( '<p>Foo</p>', '<paragraph>Foo</paragraph>' );
 			} );
 
 			it( 'config.converterPriority is defined (override downcast)', () => {
 				conversion.elementToElement( { model: 'paragraph', view: 'p' } );
 				conversion.elementToElement( { model: 'paragraph', view: 'div', converterPriority: 'high' } );
 
-				test( '<div>Foo</div>', '<paragraph>Foo</paragraph>' );
-				test( '<p>Foo</p>', '<paragraph>Foo</paragraph>', '<div>Foo</div>' );
+				testConversion( '<div>Foo</div>', '<paragraph>Foo</paragraph>' );
+				testConversion( '<p>Foo</p>', '<paragraph>Foo</paragraph>', '<div>Foo</div>' );
 			} );
 
 			it( 'config.converterPriority is defined (override upcast)', () => {
@@ -173,7 +173,7 @@ describe( 'Conversion', () => {
 				conversion.elementToElement( { model: 'paragraph', view: 'p' } );
 				conversion.elementToElement( { model: 'foo', view: 'p', converterPriority: 'high' } );
 
-				test( '<p>Foo</p>', '<foo>Foo</foo>', '<p>Foo</p>' );
+				testConversion( '<p>Foo</p>', '<foo>Foo</foo>', '<p>Foo</p>' );
 			} );
 
 			it( 'config.view is an object', () => {
@@ -189,7 +189,7 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test( '<p class="fancy">Foo</p>', '<fancyParagraph>Foo</fancyParagraph>' );
+				testConversion( '<p class="fancy">Foo</p>', '<fancyParagraph>Foo</fancyParagraph>' );
 			} );
 
 			it( 'config.view is an object with upcastAlso defined', () => {
@@ -207,9 +207,9 @@ describe( 'Conversion', () => {
 					]
 				} );
 
-				test( '<p>Foo</p>', '<paragraph>Foo</paragraph>' );
-				test( '<div>Foo</div>', '<paragraph>Foo</paragraph>', '<p>Foo</p>' );
-				test( '<span style="display:block">Foo</span>', '<paragraph>Foo</paragraph>', '<p>Foo</p>' );
+				testConversion( '<p>Foo</p>', '<paragraph>Foo</paragraph>' );
+				testConversion( '<div>Foo</div>', '<paragraph>Foo</paragraph>', '<p>Foo</p>' );
+				testConversion( '<span style="display:block">Foo</span>', '<paragraph>Foo</paragraph>', '<p>Foo</p>' );
 			} );
 
 			it( 'upcastAlso given as a function', () => {
@@ -248,11 +248,11 @@ describe( 'Conversion', () => {
 					view: 'p'
 				} );
 
-				test( '<p></p>', '<paragraph></paragraph>' );
-				test( '<p style="font-size:20px"></p>', '<paragraph></paragraph>', '<p></p>' );
+				testConversion( '<p></p>', '<paragraph></paragraph>' );
+				testConversion( '<p style="font-size:20px"></p>', '<paragraph></paragraph>', '<p></p>' );
 
-				test( '<h2></h2>', '<heading></heading>' );
-				test( '<p style="font-size:26px"></p>', '<heading></heading>', '<h2></h2>' );
+				testConversion( '<h2></h2>', '<heading></heading>' );
+				testConversion( '<p style="font-size:26px"></p>', '<heading></heading>', '<h2></h2>' );
 			} );
 		} );
 
@@ -264,15 +264,19 @@ describe( 'Conversion', () => {
 			it( 'config.view is a string', () => {
 				conversion.attributeToElement( { model: 'bold', view: 'strong' } );
 
-				test( '<p><strong>Foo</strong> bar</p>', '<paragraph><$text bold="true">Foo</$text> bar</paragraph>' );
+				testConversion( '<p><strong>Foo</strong> bar</p>', '<paragraph><$text bold="true">Foo</$text> bar</paragraph>' );
 			} );
 
 			it( 'config.converterPriority is defined (override downcast)', () => {
 				conversion.attributeToElement( { model: 'bold', view: 'strong' } );
 				conversion.attributeToElement( { model: 'bold', view: 'b', converterPriority: 'high' } );
 
-				test( '<p><b>Foo</b></p>', '<paragraph><$text bold="true">Foo</$text></paragraph>' );
-				test( '<p><strong>Foo</strong></p>', '<paragraph><$text bold="true">Foo</$text></paragraph>', '<p><b>Foo</b></p>' );
+				testConversion( '<p><b>Foo</b></p>', '<paragraph><$text bold="true">Foo</$text></paragraph>' );
+				testConversion(
+					'<p><strong>Foo</strong></p>',
+					'<paragraph><$text bold="true">Foo</$text></paragraph>',
+					'<p><b>Foo</b></p>'
+				);
 			} );
 
 			it( 'config.converterPriority is defined (override upcast)', () => {
@@ -282,7 +286,7 @@ describe( 'Conversion', () => {
 				conversion.attributeToElement( { model: 'bold', view: 'strong' } );
 				conversion.attributeToElement( { model: 'foo', view: 'strong', converterPriority: 'high' } );
 
-				test(
+				testConversion(
 					'<p><strong>Foo</strong></p>',
 					'<paragraph><$text foo="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
@@ -298,7 +302,7 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test( '<p><span class="bold">Foo</span> bar</p>', '<paragraph><$text bold="true">Foo</$text> bar</paragraph>' );
+				testConversion( '<p><span class="bold">Foo</span> bar</p>', '<paragraph><$text bold="true">Foo</$text> bar</paragraph>' );
 			} );
 
 			it( 'config.view is an object with upcastAlso defined', () => {
@@ -334,48 +338,48 @@ describe( 'Conversion', () => {
 					]
 				} );
 
-				test(
+				testConversion(
 					'<p><strong>Foo</strong></p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p><b>Foo</b></p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span class="bold">Foo</span></p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-weight: bold;">Foo</span></p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-weight: 500;">Foo</span></p>',
 					'<paragraph>Foo</paragraph>',
 					'<p>Foo</p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-weight: 600;">Foo</span></p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
 				);
 
-				test(
+				testConversion(
 					'<p style="font-weight: 600;">Foo</p>',
 					'<paragraph><$text bold="true">Foo</$text></paragraph>',
 					'<p><strong>Foo</strong></p>'
 				);
 
-				test(
+				testConversion(
 					'<p><x-bold style="font-wieght:bold">Foo</x-bold></p>',
 					'<paragraph><$text xBold="true">Foo</$text></paragraph>',
 					'<p><x-bold>Foo</x-bold></p>'
@@ -452,29 +456,29 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test(
+				testConversion(
 					'<p><span style="font-size:1.2em">Foo</span> bar</p>',
 					'<paragraph><$text fontSize="big">Foo</$text> bar</paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-size:12px">Foo</span> bar</p>',
 					'<paragraph><$text fontSize="big">Foo</$text> bar</paragraph>',
 					'<p><span style="font-size:1.2em">Foo</span> bar</p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-size:0.8em">Foo</span> bar</p>',
 					'<paragraph><$text fontSize="small">Foo</$text> bar</paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-size:8px">Foo</span> bar</p>',
 					'<paragraph><$text fontSize="small">Foo</$text> bar</paragraph>',
 					'<p><span style="font-size:0.8em">Foo</span> bar</p>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="font-size:10px">Foo</span> bar</p>',
 					'<paragraph>Foo bar</paragraph>',
 					'<p>Foo bar</p>'
@@ -508,17 +512,17 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test(
+				testConversion(
 					'<p><span style="text-decoration:underline">Foo</span></p>',
 					'<paragraph><$text textDecoration="underline">Foo</$text></paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="text-decoration:line-through">Foo</span></p>',
 					'<paragraph><$text textDecoration="lineThrough">Foo</$text></paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p><span style="text-decoration:underline">Foo</span></p>',
 					'<paragraph><$text textDecoration="underline">Foo</$text></paragraph>'
 				);
@@ -530,7 +534,7 @@ describe( 'Conversion', () => {
 				conversion.elementToElement( { model: 'image', view: 'img' } );
 
 				schema.register( 'image', {
-					inheritAllFrom: '$block',
+					inheritAllFrom: '$block'
 				} );
 			} );
 
@@ -541,7 +545,7 @@ describe( 'Conversion', () => {
 
 				conversion.attributeToAttribute( { model: 'source', view: 'src' } );
 
-				test( '<img src="foo.jpg"></img>', '<image source="foo.jpg"></image>' );
+				testConversion( '<img src="foo.jpg"></img>', '<image source="foo.jpg"></image>' );
 			} );
 
 			it( 'config.view and config.model are objects', () => {
@@ -566,8 +570,8 @@ describe( 'Conversion', () => {
 
 				conversion.elementToElement( { model: 'paragraph', view: 'p' } );
 
-				test( '<img class="aside half-size"></img>', '<image aside="aside"></image>' );
-				test( '<p class="aside half-size"></p>', '<paragraph></paragraph>', '<p></p>' );
+				testConversion( '<img class="aside half-size"></img>', '<image aside="aside"></image>' );
+				testConversion( '<p class="aside half-size"></p>', '<paragraph></paragraph>', '<p></p>' );
 			} );
 
 			it( 'config.view and config.model are objects - convert to style attribute', () => {
@@ -596,8 +600,8 @@ describe( 'Conversion', () => {
 
 				conversion.elementToElement( { model: 'paragraph', view: 'p' } );
 
-				test( '<img style="float:right;margin:5px;width:50%"></img>', '<image aside="aside"></image>' );
-				test( '<p style="float:right;margin:5px;width:50%"></p>', '<paragraph></paragraph>', '<p></p>' );
+				testConversion( '<img style="float:right;margin:5px;width:50%"></img>', '<image aside="aside"></image>' );
+				testConversion( '<p style="float:right;margin:5px;width:50%"></p>', '<paragraph></paragraph>', '<p></p>' );
 			} );
 
 			it( 'config is an array with upcastAlso defined', () => {
@@ -636,23 +640,23 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test(
+				testConversion(
 					'<p class="align-right">Foo</p>',
 					'<paragraph align="right">Foo</paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p style="text-align:right">Foo</p>',
 					'<paragraph align="right">Foo</paragraph>',
 					'<p class="align-right">Foo</p>'
 				);
 
-				test(
+				testConversion(
 					'<p class="align-center">Foo</p>',
 					'<paragraph align="center">Foo</paragraph>'
 				);
 
-				test(
+				testConversion(
 					'<p style="text-align:center">Foo</p>',
 					'<paragraph align="center">Foo</paragraph>',
 					'<p class="align-center">Foo</p>'
@@ -675,7 +679,7 @@ describe( 'Conversion', () => {
 					}
 				} );
 
-				test( '<img src="foo.jpg"></img>', '<image source="foo.jpg"></image>' );
+				testConversion( '<img src="foo.jpg"></img>', '<image source="foo.jpg"></image>' );
 			} );
 
 			// #1443.
@@ -694,7 +698,7 @@ describe( 'Conversion', () => {
 				conversion.attributeToAttribute( { model: 'border', view: { key: 'class', value: 'border' } } );
 				conversion.attributeToAttribute( { model: 'shade', view: { key: 'class', value: 'shade' } } );
 
-				test(
+				testConversion(
 					'<div class="border"><div class="shade"></div></div>',
 					'<div border="border"><div shade="shade"></div></div>'
 				);
@@ -708,11 +712,11 @@ describe( 'Conversion', () => {
 				conversion.attributeToAttribute( { model: 'foo', view: 'foo' } );
 				conversion.attributeToAttribute( { model: 'foo', view: 'foofoo', converterPriority: 'high' } );
 
-				test( '<img foo="foo"></img>', '<image foo="foo"></image>', '<img foofoo="foo"></img>' );
+				testConversion( '<img foo="foo"></img>', '<image foo="foo"></image>', '<img foofoo="foo"></img>' );
 			} );
 		} );
 
-		function test( input, expectedModel, expectedView = null ) {
+		function testConversion( input, expectedModel, expectedView = null ) {
 			loadData( input );
 
 			expect( modelStringify( model.document.getRoot() ) ).to.equal( expectedModel );

+ 1 - 1
packages/ckeditor5-engine/tests/conversion/downcastdispatcher.js

@@ -102,7 +102,7 @@ describe( 'DowncastDispatcher', () => {
 				{ type: 'insert', position, length: 1 },
 				{ type: 'attribute', position, range, attributeKey: 'key', attributeOldValue: null, attributeNewValue: 'foo' },
 				{ type: 'remove', position, length: 1, name: 'paragraph' },
-				{ type: 'insert', position, length: 3 },
+				{ type: 'insert', position, length: 3 }
 			];
 
 			view.change( writer => {

+ 24 - 24
packages/ckeditor5-engine/tests/conversion/downcasthelpers.js

@@ -1825,7 +1825,7 @@ describe( 'downcast selection converters', () => {
 	describe( 'default converters', () => {
 		describe( 'range selection', () => {
 			it( 'in same container', () => {
-				test(
+				testSelection(
 					[ 1, 4 ],
 					'foobar',
 					'f{oob}ar'
@@ -1833,7 +1833,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in same container with unicode characters', () => {
-				test(
+				testSelection(
 					[ 2, 6 ],
 					'நிலைக்கு',
 					'நி{லைக்}கு'
@@ -1841,7 +1841,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in same container, over attribute', () => {
-				test(
+				testSelection(
 					[ 1, 5 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'f{o<strong>ob</strong>a}r'
@@ -1849,7 +1849,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in same container, next to attribute', () => {
-				test(
+				testSelection(
 					[ 1, 2 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'f{o}<strong>ob</strong>ar'
@@ -1857,7 +1857,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in same attribute', () => {
-				test(
+				testSelection(
 					[ 2, 4 ],
 					'f<$text bold="true">ooba</$text>r',
 					'f<strong>o{ob}a</strong>r'
@@ -1865,7 +1865,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in same attribute, selection same as attribute', () => {
-				test(
+				testSelection(
 					[ 2, 4 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'fo{<strong>ob</strong>}ar'
@@ -1873,7 +1873,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'starts in text node, ends in attribute #1', () => {
-				test(
+				testSelection(
 					[ 1, 3 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'f{o<strong>o}b</strong>ar'
@@ -1881,7 +1881,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'starts in text node, ends in attribute #2', () => {
-				test(
+				testSelection(
 					[ 1, 4 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'f{o<strong>ob</strong>}ar'
@@ -1889,7 +1889,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'starts in attribute, ends in text node', () => {
-				test(
+				testSelection(
 					[ 3, 5 ],
 					'fo<$text bold="true">ob</$text>ar',
 					'fo<strong>o{b</strong>a}r'
@@ -1904,7 +1904,7 @@ describe( 'downcast selection converters', () => {
 				}, { priority: 'high' } );
 
 				// Similar test case as the first in this suite.
-				test(
+				testSelection(
 					[ 1, 4 ],
 					'foobar',
 					'foobar' // No selection in view.
@@ -1912,7 +1912,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'should convert backward selection', () => {
-				test(
+				testSelection(
 					[ 1, 3, 'backward' ],
 					'foobar',
 					'f{oo}bar'
@@ -1930,7 +1930,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in container', () => {
-				test(
+				testSelection(
 					[ 1, 1 ],
 					'foobar',
 					'f{}oobar'
@@ -1938,7 +1938,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'in attribute', () => {
-				test(
+				testSelection(
 					[ 3, 3 ],
 					'f<$text bold="true">ooba</$text>r',
 					'f<strong>oo{}ba</strong>r'
@@ -2139,7 +2139,7 @@ describe( 'downcast selection converters', () => {
 				}, { priority: 'high' } );
 
 				// Similar test case as above.
-				test(
+				testSelection(
 					[ 3, 3 ],
 					'f<$text bold="true">ooba</$text>r',
 					'foobar' // No selection in view and no attribute.
@@ -2151,13 +2151,13 @@ describe( 'downcast selection converters', () => {
 	describe( 'clean-up', () => {
 		describe( 'convertRangeSelection', () => {
 			it( 'should remove all ranges before adding new range', () => {
-				test(
+				testSelection(
 					[ 0, 2 ],
 					'foobar',
 					'{fo}obar'
 				);
 
-				test(
+				testSelection(
 					[ 3, 5 ],
 					'foobar',
 					'foo{ba}r'
@@ -2169,13 +2169,13 @@ describe( 'downcast selection converters', () => {
 
 		describe( 'convertCollapsedSelection', () => {
 			it( 'should remove all ranges before adding new range', () => {
-				test(
+				testSelection(
 					[ 2, 2 ],
 					'foobar',
 					'fo{}obar'
 				);
 
-				test(
+				testSelection(
 					[ 3, 3 ],
 					'foobar',
 					'foo{}bar'
@@ -2187,7 +2187,7 @@ describe( 'downcast selection converters', () => {
 
 		describe( 'clearAttributes', () => {
 			it( 'should remove all ranges before adding new range', () => {
-				test(
+				testSelection(
 					[ 3, 3 ],
 					'foobar',
 					'foo<strong>[]</strong>bar',
@@ -2210,7 +2210,7 @@ describe( 'downcast selection converters', () => {
 			} );
 
 			it( 'should do nothing if the attribute element had been already removed', () => {
-				test(
+				testSelection(
 					[ 3, 3 ],
 					'foobar',
 					'foo<strong>[]</strong>bar',
@@ -2288,7 +2288,7 @@ describe( 'downcast selection converters', () => {
 		} );
 
 		it( 'should not be used to convert selection that is not on table cell', () => {
-			test(
+			testSelection(
 				[ 1, 5 ],
 				'f{o<$text bold="true">ob</$text>a}r',
 				'f{o<strong>ob</strong>a}r'
@@ -2296,7 +2296,7 @@ describe( 'downcast selection converters', () => {
 		} );
 
 		it( 'should add a class to the selected table cell', () => {
-			test(
+			testSelection(
 				// table tr#0 td#0 [foo, table tr#0 td#0 bar]
 				[ [ 0, 0, 0, 0 ], [ 0, 0, 0, 3 ] ],
 				'<table><tr><td>foo</td></tr><tr><td>bar</td></tr></table>',
@@ -2305,7 +2305,7 @@ describe( 'downcast selection converters', () => {
 		} );
 
 		it( 'should not be used if selection contains more than just a table cell', () => {
-			test(
+			testSelection(
 				// table tr td#1 f{oo bar, table tr#2 bar]
 				[ [ 0, 0, 0, 1 ], [ 0, 0, 1, 3 ] ],
 				'<table><tr><td>foo</td><td>bar</td></tr></table>',
@@ -2319,7 +2319,7 @@ describe( 'downcast selection converters', () => {
 	// to set the selection (because then we would test converters using converters).
 	// Instead, the `test` function expects to be passed `selectionPaths` which is an array containing two numbers or two arrays,
 	// that are offsets or paths of selection positions in root element.
-	function test( selectionPaths, modelInput, expectedView, selectionAttributes = {} ) {
+	function testSelection( selectionPaths, modelInput, expectedView, selectionAttributes = {} ) {
 		// Parse passed `modelInput` string and set it as current model.
 		setModelData( model, modelInput );
 

+ 2 - 2
packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js

@@ -303,7 +303,7 @@ describe( 'UpcastDispatcher', () => {
 					new ModelElement( '$marker', { 'data-name': 'marker2' } ),
 					new ModelText( 'b' ),
 					new ModelElement( '$marker', { 'data-name': 'marker1' } ),
-					new ModelText( 'ar' ),
+					new ModelText( 'ar' )
 				] );
 
 				// Insert to conversion tree.
@@ -602,7 +602,7 @@ describe( 'UpcastDispatcher', () => {
 				const spy = sinon.spy();
 
 				model.schema.register( 'div', {
-					allowIn: '$root',
+					allowIn: '$root'
 				} );
 
 				dispatcher.on( 'documentFragment', ( evt, data, conversionApi ) => {

+ 11 - 11
packages/ckeditor5-engine/tests/dev-utils/model.js

@@ -131,43 +131,43 @@ describe( 'model test utils', () => {
 		} );
 
 		it( 'should insert text', () => {
-			test( 'this is test text', '[]this is test text' );
+			testUtils( 'this is test text', '[]this is test text' );
 		} );
 
 		it( 'should insert text with selection around', () => {
-			test( '[this is test text]' );
+			testUtils( '[this is test text]' );
 		} );
 
 		it( 'should insert text with selection inside #1', () => {
-			test( 'this [is test] text' );
+			testUtils( 'this [is test] text' );
 		} );
 
 		it( 'should insert text with selection inside #2', () => {
-			test( '[this is test] text' );
+			testUtils( '[this is test] text' );
 		} );
 
 		it( 'should insert text with selection inside #3', () => {
-			test( 'this is [test text]' );
+			testUtils( 'this is [test text]' );
 		} );
 
 		it( 'should insert unicode text with selection', () => {
-			test( 'நி[லைக்]கு' );
+			testUtils( 'நி[லைக்]கு' );
 		} );
 
 		it( 'should insert element', () => {
-			test( '<b>foo bar</b>', '[]<b>foo bar</b>' );
+			testUtils( '<b>foo bar</b>', '[]<b>foo bar</b>' );
 		} );
 
 		it( 'should insert element with selection inside #1', () => {
-			test( '<b>[foo ]bar</b>' );
+			testUtils( '<b>[foo ]bar</b>' );
 		} );
 
 		it( 'should insert element with selection inside #2', () => {
-			test( '[<b>foo ]bar</b>' );
+			testUtils( '[<b>foo ]bar</b>' );
 		} );
 
 		it( 'should insert element with selection inside #3', () => {
-			test( '<b>[foo bar</b>]' );
+			testUtils( '<b>[foo bar</b>]' );
 		} );
 
 		it( 'should insert backward selection', () => {
@@ -201,7 +201,7 @@ describe( 'model test utils', () => {
 			expect( getData( model, { rootName: 'textOnly' } ) ).to.equal( 'a[b]c' );
 		} );
 
-		function test( data, expected ) {
+		function testUtils( data, expected ) {
 			expected = expected || data;
 
 			setData( model, data );

+ 2 - 2
packages/ckeditor5-engine/tests/model/differ.js

@@ -180,7 +180,7 @@ describe( 'Differ', () => {
 				// so there is also a diff for text.
 				expectChanges( [
 					{ type: 'attribute', range: diffRange, attributeKey: 'align', attributeOldValue: null, attributeNewValue: 'center' },
-					{ type: 'insert', name: '$text', length: 3, position },
+					{ type: 'insert', name: '$text', length: 3, position }
 				] );
 			} );
 		} );
@@ -431,7 +431,7 @@ describe( 'Differ', () => {
 				remove( removePositionB, 2 );
 
 				expectChanges( [
-					{ type: 'remove', name: '$text', length: 3, position: removePositionB },
+					{ type: 'remove', name: '$text', length: 3, position: removePositionB }
 				] );
 			} );
 		} );

+ 8 - 8
packages/ckeditor5-engine/tests/model/position.js

@@ -1209,14 +1209,14 @@ describe( 'Position', () => {
 			const pos1 = new Position( root, [ 0 ] );
 			const pos2 = new Position( otherRoot, [ 0 ] );
 
-			test( pos1, pos2, null );
+			testAncestor( pos1, pos2, null );
 		} );
 
 		it( 'for two the same positions returns the parent element #1', () => {
 			const fPosition = new Position( root, [ 1, 0, 0 ] );
 			const otherPosition = new Position( root, [ 1, 0, 0 ] );
 
-			test( fPosition, otherPosition, li1 );
+			testAncestor( fPosition, otherPosition, li1 );
 		} );
 
 		it( 'for two the same positions returns the parent element #2', () => {
@@ -1230,21 +1230,21 @@ describe( 'Position', () => {
 
 			const postion = new Position( root, [ 0, 3 ] ); // <p>foo^bar</p>
 
-			test( postion, postion, p );
+			testAncestor( postion, postion, p );
 		} );
 
 		it( 'for two positions in the same element returns the element', () => {
 			const fPosition = new Position( root, [ 1, 0, 0 ] );
 			const zPosition = new Position( root, [ 1, 0, 2 ] );
 
-			test( fPosition, zPosition, li1 );
+			testAncestor( fPosition, zPosition, li1 );
 		} );
 
 		it( 'works when one positions is nested deeper than the other', () => {
 			const zPosition = new Position( root, [ 1, 0, 2 ] );
 			const liPosition = new Position( root, [ 1, 1 ] );
 
-			test( liPosition, zPosition, ul );
+			testAncestor( liPosition, zPosition, ul );
 		} );
 
 		// Checks if by mistake someone didn't use getCommonPath() + getNodeByPath().
@@ -1259,7 +1259,7 @@ describe( 'Position', () => {
 
 			const postion = new Position( root, [ 0, 0 ] ); // <p>^<a></a></p>
 
-			test( postion, postion, p );
+			testAncestor( postion, postion, p );
 		} );
 
 		it( 'works fine with positions located in DocumentFragment', () => {
@@ -1267,10 +1267,10 @@ describe( 'Position', () => {
 			const zPosition = new Position( docFrag, [ 1, 0, 2 ] );
 			const afterLiPosition = new Position( docFrag, [ 1, 2 ] );
 
-			test( zPosition, afterLiPosition, ul );
+			testAncestor( zPosition, afterLiPosition, ul );
 		} );
 
-		function test( positionA, positionB, lca ) {
+		function testAncestor( positionA, positionB, lca ) {
 			expect( positionA.getCommonAncestor( positionB ) ).to.equal( lca );
 			expect( positionB.getCommonAncestor( positionA ) ).to.equal( lca );
 		}

+ 4 - 4
packages/ckeditor5-engine/tests/model/utils/insertcontent.js

@@ -392,7 +392,7 @@ describe( 'DataController utils', () => {
 				} );
 				schema.register( 'inlineWidget', {
 					isObject: true,
-					allowIn: [ '$block', '$clipboardHolder' ],
+					allowIn: [ '$block', '$clipboardHolder' ]
 				} );
 				schema.register( 'listItem', {
 					inheritAllFrom: '$block',
@@ -620,7 +620,7 @@ describe( 'DataController utils', () => {
 				it( 'should not merge a paragraph wrapped in blockQuote with list item (checking left merge)', () => {
 					model.schema.register( 'blockQuote', {
 						allowWhere: '$block',
-						allowContentOf: '$root',
+						allowContentOf: '$root'
 					} );
 
 					setData( model, '<listItem>fo[]o</listItem>' );
@@ -647,7 +647,7 @@ describe( 'DataController utils', () => {
 				it( 'should not merge a paragraph wrapped in blockQuote with list item (checking right merge)', () => {
 					model.schema.register( 'blockQuote', {
 						allowWhere: '$block',
-						allowContentOf: '$root',
+						allowContentOf: '$root'
 					} );
 
 					setData( model, '<listItem>fo[]o</listItem>' );
@@ -674,7 +674,7 @@ describe( 'DataController utils', () => {
 				it( 'should not merge a paragraph wrapped in blockQuote with list item (checking both merges)', () => {
 					model.schema.register( 'blockQuote', {
 						allowWhere: '$block',
-						allowContentOf: '$root',
+						allowContentOf: '$root'
 					} );
 
 					setData( model, '<listItem>fo[]o</listItem>' );

+ 5 - 5
packages/ckeditor5-engine/tests/model/writer.js

@@ -1461,22 +1461,22 @@ describe( 'Writer', () => {
 
 		describe( 'should create a marker operation if a marker was affected', () => {
 			it( '<p>Foo[</p><p>Bar]</p>', () => {
-				test( p1, 'end', p2, 0 );
+				testMerge( p1, 'end', p2, 0 );
 			} );
 
 			it( '<p>[Foo</p><p>]Bar</p>', () => {
-				test( p1, 0, p2, 0 );
+				testMerge( p1, 0, p2, 0 );
 			} );
 
 			it( '<p>[Foo</p>]<p>Bar</p>', () => {
-				test( p1, 0, root, 1 );
+				testMerge( p1, 0, root, 1 );
 			} );
 
 			it( '<p>Foo</p>[<p>Bar]</p>', () => {
-				test( root, 1, p2, 'end' );
+				testMerge( root, 1, p2, 'end' );
 			} );
 
-			function test( startElement, startOffset, endElement, endOffset ) {
+			function testMerge( startElement, startOffset, endElement, endOffset ) {
 				const markerRange = new Range(
 					Position._createAt( startElement, startOffset ),
 					Position._createAt( endElement, endOffset )

+ 15 - 15
packages/ckeditor5-engine/tests/utils/bindtwostepcarettoattribute.js

@@ -66,7 +66,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 			testTwoStepCaretMovement( [
 				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
 				'→',
-				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
+				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 }
 			] );
 		} );
 
@@ -76,7 +76,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 			testTwoStepCaretMovement( [
 				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
 				'→',
-				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
+				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 }
 			] );
 		} );
 
@@ -91,7 +91,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: true, preventDefault: 1, evtStopCalled: 1 },
 				'→',
 				// Caret movement was not blocked this time (still once) so everything works normally.
-				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
+				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 }
 			] );
 		} );
 
@@ -105,7 +105,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				// Gravity is overridden, caret movement is blocked, selection at the end but "outside" the text.
 				{ selectionAttributes: [ 'c' ], isGravityOverridden: true, preventDefault: 1, evtStopCalled: 1 },
 				'→',
-				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
+				{ selectionAttributes: [ 'c' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 }
 			] );
 		} );
 
@@ -216,7 +216,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [ 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
 				'→',
 				// <paragraph><$text a="1">bar</$text></paragraph><paragraph>fo[]o</paragraph>
-				{ selectionAttributes: [ 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
+				{ selectionAttributes: [ 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 }
 			] );
 		} );
 	} );
@@ -234,7 +234,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				'←',
 				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
 				'←',
-				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
+				{ selectionAttributes: [ 'a', 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 }
 			] );
 		} );
 
@@ -284,7 +284,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 			testTwoStepCaretMovement( [
 				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
 				'←',
-				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
+				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 }
 			] );
 		} );
 
@@ -412,7 +412,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				'←',
 				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
 				'←',
-				{ selectionAttributes: [ 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 },
+				{ selectionAttributes: [ 'b' ], isGravityOverridden: false, preventDefault: 1, evtStopCalled: 1 }
 			] );
 		} );
 	} );
@@ -440,7 +440,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 },
 				'w',
 				// <$text a="1">xyw[]</$text>
-				{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 },
+				{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 }
 			] );
 		} );
 
@@ -463,7 +463,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [ 'a' ], isGravityOverridden: true, preventDefault: 2, evtStopCalled: 2 },
 				'a',
 				// zx<$text a="1">a[]x</$text>
-				{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 },
+				{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 }
 			] );
 		} );
 
@@ -497,7 +497,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 },
 				'←',
 				// fo[]o <$text a="1">bar</$text>
-				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 },
+				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 2, evtStopCalled: 2 }
 			] );
 		} );
 
@@ -607,7 +607,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [], isGravityOverridden: true, preventDefault: 4, evtStopCalled: 4 },
 				'→',
 				// foo<$text a="true">foo</$text><$text a="true" c="true">bar</$text><$text c="true">baz</$text>q[]ux
-				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 4, evtStopCalled: 4 },
+				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 4, evtStopCalled: 4 }
 			] );
 		} );
 
@@ -649,7 +649,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 4, evtStopCalled: 4 },
 				'←',
 				// fo[]o<$text a="true">foo</$text><$text a="true" c="true">bar</$text><$text c="true">baz</$text>qux
-				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 4, evtStopCalled: 4 },
+				{ selectionAttributes: [], isGravityOverridden: false, preventDefault: 4, evtStopCalled: 4 }
 			] );
 		} );
 	} );
@@ -747,7 +747,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 		testTwoStepCaretMovement( [
 			{ selectionAttributes: [ 'a' ], isGravityOverridden: false, preventDefault: 0, evtStopCalled: 0 },
 			'→',
-			{ selectionAttributes: [], isGravityOverridden: true, preventDefault: 1, evtStopCalled: 1 },
+			{ selectionAttributes: [], isGravityOverridden: true, preventDefault: 1, evtStopCalled: 1 }
 		] );
 
 		// Simulate an external text insertion BEFORE the user selection to trigger #change:range.
@@ -854,7 +854,7 @@ describe( 'bindTwoStepCaretToAttribute()', () => {
 	function fireKeyDownEvent( options ) {
 		const eventInfo = new EventInfo( view.document, 'keydown' );
 		const eventData = new DomEventData( view.document, {
-			target: document.body,
+			target: document.body
 		}, options );
 
 		sinon.stub( eventInfo, 'stop' ).callsFake( evtStopSpy );

+ 128 - 128
packages/ckeditor5-engine/tests/view/domconverter/view-to-dom.js

@@ -248,7 +248,7 @@ describe( 'DomConverter', () => {
 				);
 			} );
 
-			function test( inputTexts, output ) {
+			function testConvert( inputTexts, output ) {
 				if ( typeof inputTexts == 'string' ) {
 					inputTexts = [ inputTexts ];
 				}
@@ -272,150 +272,150 @@ describe( 'DomConverter', () => {
 			}
 
 			// At the beginning.
-			test( ' x', '_x' );
-			test( '  x', '_ x' );
-			test( '   x', '_ _x' );
-			test( '    x', '_ _ x' );
+			testConvert( ' x', '_x' );
+			testConvert( '  x', '_ x' );
+			testConvert( '   x', '_ _x' );
+			testConvert( '    x', '_ _ x' );
 
 			// At the end.
-			test( 'x ', 'x_' );
-			test( 'x  ', 'x _' );
-			test( 'x   ', 'x __' );
-			test( 'x    ', 'x _ _' );
+			testConvert( 'x ', 'x_' );
+			testConvert( 'x  ', 'x _' );
+			testConvert( 'x   ', 'x __' );
+			testConvert( 'x    ', 'x _ _' );
 
 			// In the middle.
-			test( 'x x', 'x x' );
-			test( 'x  x', 'x _x' );
-			test( 'x   x', 'x _ x' );
-			test( 'x    x', 'x _ _x' );
+			testConvert( 'x x', 'x x' );
+			testConvert( 'x  x', 'x _x' );
+			testConvert( 'x   x', 'x _ x' );
+			testConvert( 'x    x', 'x _ _x' );
 
 			// Complex.
-			test( ' x ', '_x_' );
-			test( '  x  x  ', '_ x _x _' );
-			test( '   x x  ', '_ _x x _' );
-			test( '   x x   ', '_ _x x __' );
-			test( '   x    x ', '_ _x _ _x_' );
+			testConvert( ' x ', '_x_' );
+			testConvert( '  x  x  ', '_ x _x _' );
+			testConvert( '   x x  ', '_ _x x _' );
+			testConvert( '   x x   ', '_ _x x __' );
+			testConvert( '   x    x ', '_ _x _ _x_' );
 
 			// Only spaces.
-			test( ' ', '_' );
-			test( '  ', '__' );
-			test( '   ', '_ _' );
-			test( '    ', '_ __' );
-			test( '     ', '_ _ _' );
-			test( '      ', '_ _ __' );
+			testConvert( ' ', '_' );
+			testConvert( '  ', '__' );
+			testConvert( '   ', '_ _' );
+			testConvert( '    ', '_ __' );
+			testConvert( '     ', '_ _ _' );
+			testConvert( '      ', '_ _ __' );
 
 			// With hard &nbsp;
 			// It should be treated like a normal sign.
-			test( '_x', '_x' );
-			test( ' _x', '__x' );
-			test( '  _x', '_ _x' );
-			test( ' __x', '___x' );
-			test( '___x', '___x' );
-			test( '_ _x', '_ _x' );
-			test( ' _ x', '__ x' );
-			test( '  _x', '_ _x' );
-
-			test( 'x_', 'x_' );
-			test( 'x_ ', 'x__' );
-			test( 'x_  ', 'x_ _' );
-			test( 'x__ ', 'x___' );
-			test( 'x___', 'x___' );
-			test( 'x_ _', 'x_ _' );
-			test( 'x _ ', 'x __' );
-			test( 'x  _', 'x __' );
-
-			test( 'x_x', 'x_x' );
-			test( 'x___x', 'x___x' );
-			test( 'x__ x', 'x__ x' );
-			test( 'x_  x', 'x_ _x' );
-			test( 'x  _x', 'x __x' );
-			test( 'x __x', 'x __x' );
-			test( 'x _ x', 'x _ x' );
-			test( 'x  _  x', 'x __ _x' );
-
-			test( [ 'x', 'y' ], 'xy' );
-			test( [ 'x ', 'y' ], 'x y' );
-			test( [ 'x  ', 'y' ], 'x _y' );
-			test( [ 'x   ', 'y' ], 'x __y' );
-			test( [ 'x    ', 'y' ], 'x _ _y' );
-
-			test( [ 'x', ' y' ], 'x y' );
-			test( [ 'x ', ' y' ], 'x_ y' );
-			test( [ 'x  ', ' y' ], 'x _ y' );
-			test( [ 'x   ', ' y' ], 'x __ y' );
-			test( [ 'x    ', ' y' ], 'x _ _ y' );
-
-			test( [ 'x', '_y' ], 'x_y' );
-			test( [ 'x ', '_y' ], 'x _y' );
-			test( [ 'x  ', '_y' ], 'x __y' );
+			testConvert( '_x', '_x' );
+			testConvert( ' _x', '__x' );
+			testConvert( '  _x', '_ _x' );
+			testConvert( ' __x', '___x' );
+			testConvert( '___x', '___x' );
+			testConvert( '_ _x', '_ _x' );
+			testConvert( ' _ x', '__ x' );
+			testConvert( '  _x', '_ _x' );
+
+			testConvert( 'x_', 'x_' );
+			testConvert( 'x_ ', 'x__' );
+			testConvert( 'x_  ', 'x_ _' );
+			testConvert( 'x__ ', 'x___' );
+			testConvert( 'x___', 'x___' );
+			testConvert( 'x_ _', 'x_ _' );
+			testConvert( 'x _ ', 'x __' );
+			testConvert( 'x  _', 'x __' );
+
+			testConvert( 'x_x', 'x_x' );
+			testConvert( 'x___x', 'x___x' );
+			testConvert( 'x__ x', 'x__ x' );
+			testConvert( 'x_  x', 'x_ _x' );
+			testConvert( 'x  _x', 'x __x' );
+			testConvert( 'x __x', 'x __x' );
+			testConvert( 'x _ x', 'x _ x' );
+			testConvert( 'x  _  x', 'x __ _x' );
+
+			testConvert( [ 'x', 'y' ], 'xy' );
+			testConvert( [ 'x ', 'y' ], 'x y' );
+			testConvert( [ 'x  ', 'y' ], 'x _y' );
+			testConvert( [ 'x   ', 'y' ], 'x __y' );
+			testConvert( [ 'x    ', 'y' ], 'x _ _y' );
+
+			testConvert( [ 'x', ' y' ], 'x y' );
+			testConvert( [ 'x ', ' y' ], 'x_ y' );
+			testConvert( [ 'x  ', ' y' ], 'x _ y' );
+			testConvert( [ 'x   ', ' y' ], 'x __ y' );
+			testConvert( [ 'x    ', ' y' ], 'x _ _ y' );
+
+			testConvert( [ 'x', '_y' ], 'x_y' );
+			testConvert( [ 'x ', '_y' ], 'x _y' );
+			testConvert( [ 'x  ', '_y' ], 'x __y' );
 
 			// Two text nodes.
-			test( [ 'x   ', '_y' ], 'x ___y' );
-			test( [ 'x    ', '_y' ], 'x _ __y' );
-
-			test( [ 'x', '  y' ], 'x _y' );
-			test( [ 'x ', '  y' ], 'x_ _y' );
-			test( [ 'x  ', '  y' ], 'x _ _y' );
-			test( [ 'x   ', '  y' ], 'x __ _y' );
-			test( [ 'x    ', '  y' ], 'x _ _ _y' );
-
-			test( [ 'x', '   y' ], 'x _ y' );
-			test( [ 'x ', '   y' ], 'x_ _ y' );
-			test( [ 'x  ', '   y' ], 'x _ _ y' );
-			test( [ 'x   ', '   y' ], 'x __ _ y' );
-			test( [ 'x    ', '   y' ], 'x _ _ _ y' );
-
-			test( [ 'x',	' '		], 'x_' );
-			test( [ 'x',	'  '	], 'x _' );
-			test( [ 'x',	'   '	], 'x __' );
-			test( [ 'x ',	' '		], 'x__' );
-			test( [ 'x ',	'  '	], 'x_ _' );
-			test( [ 'x ',	'   '	], 'x_ __' );
-			test( [ 'x  ',	' '		], 'x __' );
-			test( [ 'x  ',	'  '	], 'x _ _' );
-			test( [ 'x  ',	'   '	], 'x _ __' );
-			test( [ 'x   ',	' '		], 'x ___' );
-			test( [ 'x   ',	'  '	], 'x __ _' );
-			test( [ 'x   ',	'   '	], 'x __ __' );
-
-			test( [ ' ',	'x'		], '_x' );
-			test( [ '  ',	'x'		], '_ x' );
-			test( [ '   ',	'x'		], '_ _x' );
-			test( [ ' ',	' x'	], '_ x' );
-			test( [ '  ',	' x'	], '__ x' );
-			test( [ '   ',	' x'	], '_ _ x' );
-			test( [ ' ',	'  x'	], '_ _x' );
-			test( [ '  ',	'  x'	], '__ _x' );
-			test( [ '   ',	'  x'	], '_ _ _x' );
-			test( [ ' ',	'   x'	], '_ _ x' );
-			test( [ '  ',	'   x'	], '__ _ x' );
-			test( [ '   ',	'   x'	], '_ _ _ x' );
+			testConvert( [ 'x   ', '_y' ], 'x ___y' );
+			testConvert( [ 'x    ', '_y' ], 'x _ __y' );
+
+			testConvert( [ 'x', '  y' ], 'x _y' );
+			testConvert( [ 'x ', '  y' ], 'x_ _y' );
+			testConvert( [ 'x  ', '  y' ], 'x _ _y' );
+			testConvert( [ 'x   ', '  y' ], 'x __ _y' );
+			testConvert( [ 'x    ', '  y' ], 'x _ _ _y' );
+
+			testConvert( [ 'x', '   y' ], 'x _ y' );
+			testConvert( [ 'x ', '   y' ], 'x_ _ y' );
+			testConvert( [ 'x  ', '   y' ], 'x _ _ y' );
+			testConvert( [ 'x   ', '   y' ], 'x __ _ y' );
+			testConvert( [ 'x    ', '   y' ], 'x _ _ _ y' );
+
+			testConvert( [ 'x',	' '		], 'x_' );
+			testConvert( [ 'x',	'  '	], 'x _' );
+			testConvert( [ 'x',	'   '	], 'x __' );
+			testConvert( [ 'x ',	' '		], 'x__' );
+			testConvert( [ 'x ',	'  '	], 'x_ _' );
+			testConvert( [ 'x ',	'   '	], 'x_ __' );
+			testConvert( [ 'x  ',	' '		], 'x __' );
+			testConvert( [ 'x  ',	'  '	], 'x _ _' );
+			testConvert( [ 'x  ',	'   '	], 'x _ __' );
+			testConvert( [ 'x   ',	' '		], 'x ___' );
+			testConvert( [ 'x   ',	'  '	], 'x __ _' );
+			testConvert( [ 'x   ',	'   '	], 'x __ __' );
+
+			testConvert( [ ' ',	'x'		], '_x' );
+			testConvert( [ '  ',	'x'		], '_ x' );
+			testConvert( [ '   ',	'x'		], '_ _x' );
+			testConvert( [ ' ',	' x'	], '_ x' );
+			testConvert( [ '  ',	' x'	], '__ x' );
+			testConvert( [ '   ',	' x'	], '_ _ x' );
+			testConvert( [ ' ',	'  x'	], '_ _x' );
+			testConvert( [ '  ',	'  x'	], '__ _x' );
+			testConvert( [ '   ',	'  x'	], '_ _ _x' );
+			testConvert( [ ' ',	'   x'	], '_ _ x' );
+			testConvert( [ '  ',	'   x'	], '__ _ x' );
+			testConvert( [ '   ',	'   x'	], '_ _ _ x' );
 
 			// "Non-empty" + "empty" text nodes.
-			test( [ 'x',	' ',		'x'		],	'x x' );
-			test( [ 'x',	' ',		' x'	],	'x_ x' );
-			test( [ 'x',	'  ',		' x'	],	'x _ x' );
-			test( [ 'x',	'   ',		'  x'	],	'x __ _x' );
-			test( [ 'x ',	' ',		' x'	],	'x__ x' );
-			test( [ 'x ',	'  ',		' x'	],	'x_ _ x' );
-			test( [ 'x ',	'   ',		'  x'	],	'x_ __ _x' );
-			test( [ 'x  ',	' ',		' x'	],	'x __ x' );
-			test( [ 'x  ',	'  ',		' x'	],	'x _ _ x' );
-			test( [ 'x  ',	'   ',		'  x'	],	'x _ __ _x' );
-			test( [ 'x   ',	' ',		' x'	],	'x ___ x' );
-			test( [ 'x   ',	'  ',		' x'	],	'x __ _ x' );
-			test( [ 'x   ',	'   ',		'  x'	],	'x __ __ _x' );
+			testConvert( [ 'x',	' ',		'x'		],	'x x' );
+			testConvert( [ 'x',	' ',		' x'	],	'x_ x' );
+			testConvert( [ 'x',	'  ',		' x'	],	'x _ x' );
+			testConvert( [ 'x',	'   ',		'  x'	],	'x __ _x' );
+			testConvert( [ 'x ',	' ',		' x'	],	'x__ x' );
+			testConvert( [ 'x ',	'  ',		' x'	],	'x_ _ x' );
+			testConvert( [ 'x ',	'   ',		'  x'	],	'x_ __ _x' );
+			testConvert( [ 'x  ',	' ',		' x'	],	'x __ x' );
+			testConvert( [ 'x  ',	'  ',		' x'	],	'x _ _ x' );
+			testConvert( [ 'x  ',	'   ',		'  x'	],	'x _ __ _x' );
+			testConvert( [ 'x   ',	' ',		' x'	],	'x ___ x' );
+			testConvert( [ 'x   ',	'  ',		' x'	],	'x __ _ x' );
+			testConvert( [ 'x   ',	'   ',		'  x'	],	'x __ __ _x' );
 
 			// "Empty" + "empty" text nodes.
-			test( [ ' ', ' ' ], '__' );
-			test( [ '  ', ' ' ], '___' );
-			test( [ '   ', ' ' ], '_ __' );
-			test( [ ' ', '  ' ], '_ _' );
-			test( [ ' ', '   ' ], '_ __' );
-			test( [ '  ', '  ' ], '__ _' );
-			test( [ '  ', '   ' ], '__ __' );
-			test( [ '   ', '  ' ], '_ _ _' );
-			test( [ '   ', '   ' ], '_ _ __' );
+			testConvert( [ ' ', ' ' ], '__' );
+			testConvert( [ '  ', ' ' ], '___' );
+			testConvert( [ '   ', ' ' ], '_ __' );
+			testConvert( [ ' ', '  ' ], '_ _' );
+			testConvert( [ ' ', '   ' ], '_ __' );
+			testConvert( [ '  ', '  ' ], '__ _' );
+			testConvert( [ '  ', '   ' ], '__ __' );
+			testConvert( [ '   ', '  ' ], '_ _ _' );
+			testConvert( [ '   ', '   ' ], '_ _ __' );
 
 			it( 'not in preformatted blocks', () => {
 				const viewPre = new ViewContainerElement( viewDocument, 'pre', null, [

+ 22 - 22
packages/ckeditor5-engine/tests/view/downcastwriter/breakattributes.js

@@ -33,7 +33,7 @@ describe( 'DowncastWriter', () => {
 			 * @param {String} input
 			 * @param {String} expected
 			 */
-			function test( input, expected ) {
+			function testBreakAttributes( input, expected ) {
 				const { view, selection } = parse( input );
 
 				const newPosition = writer.breakAttributes( selection.getFirstPosition() );
@@ -44,28 +44,28 @@ describe( 'DowncastWriter', () => {
 			}
 
 			it( 'should not break text nodes if they are not in attribute elements - middle', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>foo{}bar</container:p>',
 					'<container:p>foo{}bar</container:p>'
 				);
 			} );
 
 			it( 'should not break text nodes if they are not in attribute elements - beginning', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>{}foobar</container:p>',
 					'<container:p>{}foobar</container:p>'
 				);
 			} );
 
 			it( 'should not break text nodes if they are not in attribute elements #2 - end', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>foobar{}</container:p>',
 					'<container:p>foobar{}</container:p>'
 				);
 			} );
 
 			it( 'should split attribute element', () => {
-				test(
+				testBreakAttributes(
 					'<container:p><attribute:b view-priority="1">foo{}bar</attribute:b></container:p>',
 					'<container:p>' +
 					'<attribute:b view-priority="1">foo</attribute:b>[]<attribute:b view-priority="1">bar</attribute:b>' +
@@ -74,7 +74,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should move from beginning of the nested text node to the container', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>' +
 					'<attribute:b view-priority="1"><attribute:u view-priority="1">{}foobar</attribute:u></attribute:b>' +
 					'</container:p>',
@@ -85,14 +85,14 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should stick selection in text node if it is in container', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>foo{}<attribute:b view-priority="1">bar</attribute:b></container:p>',
 					'<container:p>foo{}<attribute:b view-priority="1">bar</attribute:b></container:p>'
 				);
 			} );
 
 			it( 'should split nested attributes', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>' +
 					'<attribute:b view-priority="1"><attribute:u view-priority="1">foo{}bar</attribute:u></attribute:b>' +
 					'</container:p>',
@@ -113,7 +113,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should move from end of the nested text node to the container', () => {
-				test(
+				testBreakAttributes(
 					'<container:p>' +
 					'<attribute:b view-priority="1"><attribute:u view-priority="1">foobar{}</attribute:u></attribute:b>' +
 					'</container:p>',
@@ -124,14 +124,14 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should split attribute element directly in document fragment', () => {
-				test(
+				testBreakAttributes(
 					'<attribute:b view-priority="1">foo{}bar</attribute:b>',
 					'<attribute:b view-priority="1">foo</attribute:b>[]<attribute:b view-priority="1">bar</attribute:b>'
 				);
 			} );
 
 			it( 'should not split text directly in document fragment', () => {
-				test(
+				testBreakAttributes(
 					'foo{}bar',
 					'foo{}bar'
 				);
@@ -145,7 +145,7 @@ describe( 'DowncastWriter', () => {
 			 * @param {String} input
 			 * @param {String} expected
 			 */
-			function test( input, expected ) {
+			function testBreak( input, expected ) {
 				const { view, selection } = parse( input );
 
 				const newRange = writer.breakAttributes( selection.getFirstRange() );
@@ -170,21 +170,21 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not break text nodes if they are not in attribute elements', () => {
-				test(
+				testBreak(
 					'<container:p>foo{}bar</container:p>',
 					'<container:p>foo{}bar</container:p>'
 				);
 			} );
 
 			it( 'should break at collapsed range and return collapsed one', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>foo{}bar</attribute:b></container:p>',
 					'<container:p><attribute:b>foo</attribute:b>[]<attribute:b>bar</attribute:b></container:p>'
 				);
 			} );
 
 			it( 'should break inside text node #1', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>foo{bar}baz</attribute:b></container:p>',
 					'<container:p>' +
 						'<attribute:b>foo</attribute:b>[<attribute:b>bar</attribute:b>]<attribute:b>baz</attribute:b>' +
@@ -193,49 +193,49 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should break inside text node #2', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>foo{barbaz}</attribute:b></container:p>',
 					'<container:p><attribute:b>foo</attribute:b>[<attribute:b>barbaz</attribute:b>]</container:p>'
 				);
 			} );
 
 			it( 'should break inside text node #3', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>foo{barbaz]</attribute:b></container:p>',
 					'<container:p><attribute:b>foo</attribute:b>[<attribute:b>barbaz</attribute:b>]</container:p>'
 				);
 			} );
 
 			it( 'should break inside text node #4', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>{foo}barbaz</attribute:b></container:p>',
 					'<container:p>[<attribute:b>foo</attribute:b>]<attribute:b>barbaz</attribute:b></container:p>'
 				);
 			} );
 
 			it( 'should break inside text node #5', () => {
-				test(
+				testBreak(
 					'<container:p><attribute:b>[foo}barbaz</attribute:b></container:p>',
 					'<container:p>[<attribute:b>foo</attribute:b>]<attribute:b>barbaz</attribute:b></container:p>'
 				);
 			} );
 
 			it( 'should break placed inside different nodes', () => {
-				test(
+				testBreak(
 					'<container:p>foo{bar<attribute:b>baz}qux</attribute:b></container:p>',
 					'<container:p>foo{bar<attribute:b>baz</attribute:b>]<attribute:b>qux</attribute:b></container:p>'
 				);
 			} );
 
 			it( 'should split attribute element directly in document fragment', () => {
-				test(
+				testBreak(
 					'<attribute:b>fo{ob}ar</attribute:b>',
 					'<attribute:b>fo</attribute:b>[<attribute:b>ob</attribute:b>]<attribute:b>ar</attribute:b>'
 				);
 			} );
 
 			it( 'should not split text directly in document fragment', () => {
-				test(
+				testBreak(
 					'foo{}bar',
 					'foo{}bar'
 				);

+ 4 - 4
packages/ckeditor5-engine/tests/view/downcastwriter/breakcontainer.js

@@ -21,7 +21,7 @@ describe( 'DowncastWriter', () => {
 		//
 		// @param {String} input
 		// @param {String} expected
-		function test( input, expected ) {
+		function testBreakContainer( input, expected ) {
 			const { view, selection } = parse( input );
 
 			const newPosition = writer.breakContainer( selection.getFirstPosition() );
@@ -34,7 +34,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'break inside element - should break container element at given position', () => {
-			test(
+			testBreakContainer(
 				'<container:div>' +
 					'<container:p>' +
 						'<attribute:b>foo</attribute:b>[]<attribute:u>bar</attribute:u>' +
@@ -53,14 +53,14 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'break at start of element - should not break container and place returned position before element', () => {
-			test(
+			testBreakContainer(
 				'<container:div><container:p>[]foobar</container:p></container:div>',
 				'<container:div>[]<container:p>foobar</container:p></container:div>'
 			);
 		} );
 
 		it( 'break at the end of element - should not break container and place returned position after element', () => {
-			test(
+			testBreakContainer(
 				'<container:div><container:p>foobar[]</container:p></container:div>',
 				'<container:div><container:p>foobar</container:p>[]</container:div>'
 			);

+ 13 - 13
packages/ckeditor5-engine/tests/view/downcastwriter/clear.js

@@ -24,7 +24,7 @@ describe( 'DowncastWriter', () => {
 		// @param {Object} elementToRemove
 		// @param {String} input
 		// @param {String} expectedResult
-		function test( elementToRemove, input, expectedResult ) {
+		function testDowncast( elementToRemove, input, expectedResult ) {
 			const { view, selection } = parse( input );
 
 			writer.clear( selection.getFirstRange(), elementToRemove );
@@ -57,7 +57,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove matched element from range', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>[b<attribute:b>a</attribute:b>r]</container:p>',
 				'<container:p>br</container:p>'
@@ -67,7 +67,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove matched element from range when range is inside text node', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>F{o<attribute:b>o</attribute:b> ba}r</container:p>',
 				'<container:p>Fo bar</container:p>'
@@ -77,7 +77,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove multiple matched elements from range', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>[Fo<attribute:b>o</attribute:b> b<attribute:b>a</attribute:b>r]</container:p>',
 				'<container:p>Fo br</container:p>'
@@ -87,7 +87,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove multiple matched elements from range when range is inside text node', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>F{o<attribute:b>o</attribute:b> <attribute:b>b</attribute:b>a}r</container:p>',
 				'<container:p>Fo ar</container:p>'
@@ -97,7 +97,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove only matched element', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>F{o<attribute:i>o</attribute:i> <attribute:b>b</attribute:b>a}r</container:p>',
 				'<container:p>Fo<attribute:i>o</attribute:i> ar</container:p>'
@@ -107,7 +107,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove part of node when range ends inside this node', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>f{oo<attribute:b>ba}r</attribute:b></container:p>',
 				'<container:p>foo<attribute:b>r</attribute:b></container:p>'
@@ -117,7 +117,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove part of node when range starts inside this node', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>foo<attribute:b>b{ar</attribute:b>bi}z</container:p>',
 				'<container:p>foo<attribute:b>b</attribute:b>biz</container:p>'
@@ -127,7 +127,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove part of node when range starts and ends inside this node', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>foo<attribute:b>b{a}r</attribute:b>biz</container:p>',
 				'<container:p>foo<attribute:b>br</attribute:b>biz</container:p>'
@@ -137,7 +137,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should merge after removing', () => {
 			const elementToRemove = new AttributeElement( document, 'b' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>' +
 					'<attribute:a>fo{o</attribute:a><attribute:b>a</attribute:b><attribute:a>b}iz</attribute:a>' +
@@ -149,7 +149,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove EmptyElement', () => {
 			const elementToRemove = new EmptyElement( document, 'img' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>f{oo<empty:img></empty:img>ba}r</container:p>',
 				'<container:p>foobar</container:p>'
@@ -159,7 +159,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove UIElement', () => {
 			const elementToRemove = new UIElement( document, 'span' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'<container:p>f{oo<ui:span></ui:span>ba}r</container:p>',
 				'<container:p>foobar</container:p>'
@@ -169,7 +169,7 @@ describe( 'DowncastWriter', () => {
 		it( 'should remove ContainerElement', () => {
 			const elementToRemove = new ContainerElement( document, 'p' );
 
-			test(
+			testDowncast(
 				elementToRemove,
 				'[<container:div>foo</container:div><container:p>bar</container:p><container:div>biz</container:div>]',
 				'<container:div>foo</container:div><container:div>biz</container:div>'

+ 15 - 15
packages/ckeditor5-engine/tests/view/downcastwriter/insert.js

@@ -25,7 +25,7 @@ describe( 'DowncastWriter', () => {
 		// @param {String} input
 		// @param {Array.<String>} nodesToInsert
 		// @param {String} expected
-		function test( input, nodesToInsert, expected ) {
+		function testInsert( input, nodesToInsert, expected ) {
 			nodesToInsert = nodesToInsert.map( node => parse( node ) );
 			const { view, selection } = parse( input );
 
@@ -40,7 +40,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should return collapsed range in insertion position when using empty array', () => {
-			test(
+			testInsert(
 				'<container:p>foo{}bar</container:p>',
 				[],
 				'<container:p>foo{}bar</container:p>'
@@ -48,7 +48,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should insert text into another text node #1', () => {
-			test(
+			testInsert(
 				'<container:p>foo{}bar</container:p>',
 				[ 'baz' ],
 				'<container:p>foo{baz}bar</container:p>'
@@ -56,7 +56,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should insert text into another text node #2', () => {
-			test(
+			testInsert(
 				'<container:p>foobar{}</container:p>',
 				[ 'baz' ],
 				'<container:p>foobar{baz]</container:p>'
@@ -64,7 +64,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should insert text into another text node #3', () => {
-			test(
+			testInsert(
 				'<container:p>{}foobar</container:p>',
 				[ 'baz' ],
 				'<container:p>[baz}foobar</container:p>'
@@ -72,7 +72,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should break attributes when inserting into text node', () => {
-			test(
+			testInsert(
 				'<container:p>foo{}bar</container:p>',
 				[ '<attribute:b view-priority="1">baz</attribute:b>' ],
 				'<container:p>foo[<attribute:b view-priority="1">baz</attribute:b>]bar</container:p>'
@@ -80,7 +80,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge text nodes', () => {
-			test(
+			testInsert(
 				'<container:p>[]foobar</container:p>',
 				[ 'baz' ],
 				'<container:p>[baz}foobar</container:p>'
@@ -88,7 +88,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge same attribute nodes', () => {
-			test(
+			testInsert(
 				'<container:p><attribute:b view-priority="1">foo{}bar</attribute:b></container:p>',
 				[ '<attribute:b view-priority="1">baz</attribute:b>' ],
 				'<container:p><attribute:b view-priority="1">foo{baz}bar</attribute:b></container:p>'
@@ -96,7 +96,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not merge different attributes', () => {
-			test(
+			testInsert(
 				'<container:p><attribute:b view-priority="1">foo{}bar</attribute:b></container:p>',
 				[ '<attribute:b view-priority="2">baz</attribute:b>' ],
 				'<container:p>' +
@@ -116,7 +116,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should allow to insert multiple nodes', () => {
-			test(
+			testInsert(
 				'<container:p>[]</container:p>',
 				[ '<attribute:b view-priority="1">foo</attribute:b>', 'bar' ],
 				'<container:p>[<attribute:b view-priority="1">foo</attribute:b>bar]</container:p>'
@@ -124,7 +124,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge after inserting multiple nodes', () => {
-			test(
+			testInsert(
 				'<container:p><attribute:b view-priority="1">qux</attribute:b>[]baz</container:p>',
 				[ '<attribute:b view-priority="1">foo</attribute:b>', 'bar' ],
 				'<container:p><attribute:b view-priority="1">qux{foo</attribute:b>bar}baz</container:p>'
@@ -132,7 +132,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should insert text into in document fragment', () => {
-			test(
+			testInsert(
 				'foo{}bar',
 				[ 'baz' ],
 				'foo{baz}bar'
@@ -140,7 +140,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge same attribute nodes in document fragment', () => {
-			test(
+			testInsert(
 				'<attribute:b view-priority="2">foo</attribute:b>[]',
 				[ '<attribute:b view-priority="1">bar</attribute:b>' ],
 				'<attribute:b view-priority="2">foo</attribute:b>[<attribute:b view-priority="1">bar</attribute:b>]'
@@ -148,7 +148,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should insert unicode text into unicode text', () => {
-			test(
+			testInsert(
 				'நி{}க்கு',
 				[ 'லை' ],
 				'நி{லை}க்கு'
@@ -187,7 +187,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should allow to insert EmptyElement into container', () => {
-			test(
+			testInsert(
 				'<container:p>[]</container:p>',
 				[ '<empty:img></empty:img>' ],
 				'<container:p>[<empty:img></empty:img>]</container:p>'

+ 15 - 15
packages/ckeditor5-engine/tests/view/downcastwriter/mergeattributes.js

@@ -20,7 +20,7 @@ describe( 'DowncastWriter', () => {
 		//
 		// @param {String} input
 		// @param {String} expected
-		function test( input, expected ) {
+		function testMerge( input, expected ) {
 			const { view, selection } = parse( input );
 			const newPosition = writer.mergeAttributes( selection.getFirstPosition() );
 			expect( stringify( view, newPosition, { showType: true, showPriority: true } ) ).to.equal( expected );
@@ -32,32 +32,32 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not merge if inside text node', () => {
-			test( '<container:p>fo{}bar</container:p>', '<container:p>fo{}bar</container:p>' );
+			testMerge( '<container:p>fo{}bar</container:p>', '<container:p>fo{}bar</container:p>' );
 		} );
 
 		it( 'should not merge if between containers', () => {
-			test(
+			testMerge(
 				'<container:div><container:p>foo</container:p>[]<container:p>bar</container:p></container:div>',
 				'<container:div><container:p>foo</container:p>[]<container:p>bar</container:p></container:div>'
 			);
 		} );
 
 		it( 'should return same position when inside empty container', () => {
-			test(
+			testMerge(
 				'<container:p>[]</container:p>',
 				'<container:p>[]</container:p>'
 			);
 		} );
 
 		it( 'should not merge when position is placed at the beginning of the container', () => {
-			test(
+			testMerge(
 				'<container:p>[]<attribute:b view-priority="1"></attribute:b></container:p>',
 				'<container:p>[]<attribute:b view-priority="1"></attribute:b></container:p>'
 			);
 		} );
 
 		it( 'should not merge when position is placed at the end of the container', () => {
-			test(
+			testMerge(
 				'<container:p><attribute:b view-priority="1"></attribute:b>[]</container:p>',
 				'<container:p><attribute:b view-priority="1"></attribute:b>[]</container:p>'
 			);
@@ -75,7 +75,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge when placed between similar attribute nodes', () => {
-			test(
+			testMerge(
 				'<container:p>' +
 					'<attribute:b view-priority="1" foo="bar">baz</attribute:b>[]' +
 					'<attribute:b view-priority="1" foo="bar">qux</attribute:b>' +
@@ -85,7 +85,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not merge when placed between non-similar attribute nodes', () => {
-			test(
+			testMerge(
 				'<container:p>' +
 					'<attribute:b view-priority="1" foo="bar"></attribute:b>[]<attribute:b view-priority="1" foo="baz"></attribute:b>' +
 				'</container:p>',
@@ -96,7 +96,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not merge when placed between similar attribute nodes with different priority', () => {
-			test(
+			testMerge(
 				'<container:p>' +
 					'<attribute:b view-priority="1" foo="bar"></attribute:b>[]<attribute:b view-priority="2" foo="bar"></attribute:b>' +
 				'</container:p>',
@@ -107,7 +107,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge attribute nodes and their contents if possible', () => {
-			test(
+			testMerge(
 				'<container:p>' +
 					'<attribute:b view-priority="1" foo="bar">foo</attribute:b>[]' +
 					'<attribute:b view-priority="1" foo="bar">bar</attribute:b>' +
@@ -117,35 +117,35 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove empty attributes after merge #1', () => {
-			test(
+			testMerge(
 				'<container:p><attribute:b>[]</attribute:b></container:p>',
 				'<container:p>[]</container:p>'
 			);
 		} );
 
 		it( 'should remove empty attributes after merge #2', () => {
-			test(
+			testMerge(
 				'<container:p><attribute:b>foo</attribute:b><attribute:i>[]</attribute:i><attribute:b>bar</attribute:b></container:p>',
 				'<container:p><attribute:b view-priority="10">foo{}bar</attribute:b></container:p>'
 			);
 		} );
 
 		it( 'should remove empty attributes after merge #3', () => {
-			test(
+			testMerge(
 				'<container:p><attribute:b></attribute:b><attribute:i>[]</attribute:i><attribute:b></attribute:b></container:p>',
 				'<container:p>[]</container:p>'
 			);
 		} );
 
 		it( 'should not merge when placed between EmptyElements', () => {
-			test(
+			testMerge(
 				'<container:p><empty:img></empty:img>[]<empty:img></empty:img></container:p>',
 				'<container:p><empty:img></empty:img>[]<empty:img></empty:img></container:p>'
 			);
 		} );
 
 		it( 'should not merge when placed between UIElements', () => {
-			test(
+			testMerge(
 				'<container:p><ui:span></ui:span>[]<ui:span></ui:span></container:p>',
 				'<container:p><ui:span></ui:span>[]<ui:span></ui:span></container:p>'
 			);

+ 4 - 4
packages/ckeditor5-engine/tests/view/downcastwriter/mergecontainers.js

@@ -19,7 +19,7 @@ describe( 'DowncastWriter', () => {
 		//
 		// @param {String} input
 		// @param {String} expected
-		function test( input, expected ) {
+		function testMerge( input, expected ) {
 			const { view, selection } = parse( input );
 
 			const newPosition = writer.mergeContainers( selection.getFirstPosition() );
@@ -31,7 +31,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge two container elements - position between elements', () => {
-			test(
+			testMerge(
 				'<container:div>' +
 					'<attribute:b>foo</attribute:b>' +
 				'</container:div>' +
@@ -44,14 +44,14 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge two container elements - position in text', () => {
-			test(
+			testMerge(
 				'<container:div>foo</container:div>[]<container:div>bar</container:div>',
 				'<container:div>foo{}bar</container:div>'
 			);
 		} );
 
 		it( 'should merge two different container elements', () => {
-			test(
+			testMerge(
 				'<container:div>foo</container:div>[]<container:p>bar</container:p>',
 				'<container:div>foo{}bar</container:div>'
 			);

+ 11 - 11
packages/ckeditor5-engine/tests/view/downcastwriter/move.js

@@ -28,7 +28,7 @@ describe( 'DowncastWriter', () => {
 		// @param {String} input
 		// @param {String} expectedResult
 		// @param {String} expectedRemoved
-		function test( source, destination, sourceAfterMove, destinationAfterMove ) {
+		function testMove( source, destination, sourceAfterMove, destinationAfterMove ) {
 			const { view: srcView, selection: srcSelection } = parse( source );
 			const { view: dstView, selection: dstSelection } = parse( destination );
 
@@ -44,7 +44,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move single text node', () => {
-			test(
+			testMove(
 				'<container:p>[foobar]</container:p>',
 				'<container:p>[]</container:p>',
 				'<container:p></container:p>',
@@ -53,7 +53,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not leave empty text nodes', () => {
-			test(
+			testMove(
 				'<container:p>{foobar}</container:p>',
 				'<container:p>[]</container:p>',
 				'<container:p></container:p>',
@@ -62,7 +62,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move part of the text node', () => {
-			test(
+			testMove(
 				'<container:p>f{oob}ar</container:p>',
 				'<container:p>[]</container:p>',
 				'<container:p>far</container:p>',
@@ -71,7 +71,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should support unicode', () => {
-			test(
+			testMove(
 				'<container:p>நி{லை}க்கு</container:p>',
 				'<container:p>நி{}கு</container:p>',
 				'<container:p>நிக்கு</container:p>',
@@ -80,7 +80,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move parts of nodes', () => {
-			test(
+			testMove(
 				'<container:p>f{oo<attribute:b view-priority="10">ba}r</attribute:b></container:p>',
 				'<container:p>[]<attribute:b view-priority="10">qux</attribute:b></container:p>',
 				'<container:p>f<attribute:b view-priority="10">r</attribute:b></container:p>',
@@ -89,7 +89,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge after moving #1', () => {
-			test(
+			testMove(
 				'<container:p>' +
 					'<attribute:b view-priority="1">foo</attribute:b>[bar]<attribute:b view-priority="1">bazqux</attribute:b>' +
 				'</container:p>',
@@ -102,7 +102,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge after moving #2', () => {
-			test(
+			testMove(
 				'<container:p>' +
 					'<attribute:b view-priority="1">fo{o</attribute:b>bar<attribute:b view-priority="1">ba}zqux</attribute:b>' +
 				'</container:p>',
@@ -115,7 +115,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move part of the text node in document fragment', () => {
-			test( 'fo{ob}ar', 'fo{}ar', 'foar', 'fo{ob}ar' );
+			testMove( 'fo{ob}ar', 'fo{}ar', 'foar', 'fo{ob}ar' );
 		} );
 
 		it( 'should correctly move text nodes inside same parent', () => {
@@ -141,7 +141,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move EmptyElement', () => {
-			test(
+			testMove(
 				'<container:p>foo[<empty:img></empty:img>]bar</container:p>',
 				'<container:div>baz{}quix</container:div>',
 				'<container:p>foobar</container:p>',
@@ -164,7 +164,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should move UIElement', () => {
-			test(
+			testMove(
 				'<container:p>foo[<ui:span></ui:span>]bar</container:p>',
 				'<container:div>baz{}quix</container:div>',
 				'<container:p>foobar</container:p>',

+ 17 - 17
packages/ckeditor5-engine/tests/view/downcastwriter/remove.js

@@ -27,7 +27,7 @@ describe( 'DowncastWriter', () => {
 		// @param {String} expectedResult
 		// @param {String} expectedRemoved
 		// @param {Boolean} asItem
-		function test( input, expectedResult, expectedRemoved, asItem = false ) {
+		function testRemove( input, expectedResult, expectedRemoved, asItem = false ) {
 			const { view, selection } = parse( input );
 
 			const range = selection.getFirstRange();
@@ -71,19 +71,19 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove single text node', () => {
-			test( '<container:p>[foobar]</container:p>', '<container:p>[]</container:p>', 'foobar' );
+			testRemove( '<container:p>[foobar]</container:p>', '<container:p>[]</container:p>', 'foobar' );
 		} );
 
 		it( 'should not leave empty text nodes', () => {
-			test( '<container:p>{foobar}</container:p>', '<container:p>[]</container:p>', 'foobar' );
+			testRemove( '<container:p>{foobar}</container:p>', '<container:p>[]</container:p>', 'foobar' );
 		} );
 
 		it( 'should remove part of the text node', () => {
-			test( '<container:p>f{oob}ar</container:p>', '<container:p>f{}ar</container:p>', 'oob' );
+			testRemove( '<container:p>f{oob}ar</container:p>', '<container:p>f{}ar</container:p>', 'oob' );
 		} );
 
 		it( 'should remove parts of nodes #1', () => {
-			test(
+			testRemove(
 				'<container:p>f{oo<attribute:b view-priority="10">ba}r</attribute:b></container:p>',
 				'<container:p>f[]<attribute:b view-priority="10">r</attribute:b></container:p>',
 				'oo<attribute:b view-priority="10">ba</attribute:b>'
@@ -91,7 +91,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should support unicode', () => {
-			test(
+			testRemove(
 				'<container:p>நி{லை<attribute:b view-priority="10">க்}கு</attribute:b></container:p>',
 				'<container:p>நி[]<attribute:b view-priority="10">கு</attribute:b></container:p>',
 				'லை<attribute:b view-priority="10">க்</attribute:b>'
@@ -99,7 +99,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge after removing #1', () => {
-			test(
+			testRemove(
 				'<container:p>' +
 					'<attribute:b view-priority="1">foo</attribute:b>[bar]<attribute:b view-priority="1">bazqux</attribute:b>' +
 				'</container:p>',
@@ -109,7 +109,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge after removing #2', () => {
-			test(
+			testRemove(
 				'<container:p>' +
 					'<attribute:b view-priority="1">fo{o</attribute:b>bar<attribute:b view-priority="1">ba}zqux</attribute:b>' +
 				'</container:p>',
@@ -119,11 +119,11 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove part of the text node in document fragment', () => {
-			test( 'fo{ob}ar', 'fo{}ar', 'ob' );
+			testRemove( 'fo{ob}ar', 'fo{}ar', 'ob' );
 		} );
 
 		it( 'should remove EmptyElement', () => {
-			test(
+			testRemove(
 				'<container:p>foo[<empty:img></empty:img>]bar</container:p>',
 				'<container:p>foo{}bar</container:p>',
 				'<empty:img></empty:img>'
@@ -142,7 +142,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove UIElement', () => {
-			test(
+			testRemove(
 				'<container:p>foo[<ui:span></ui:span>]bar</container:p>',
 				'<container:p>foo{}bar</container:p>',
 				'<ui:span></ui:span>'
@@ -161,19 +161,19 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove single text node (as item)', () => {
-			test( '<container:p>[foobar]</container:p>', '<container:p></container:p>', 'foobar', true );
+			testRemove( '<container:p>[foobar]</container:p>', '<container:p></container:p>', 'foobar', true );
 		} );
 
 		it( 'should not leave empty text nodes (as item)', () => {
-			test( '<container:p>{foobar}</container:p>', '<container:p></container:p>', 'foobar', true );
+			testRemove( '<container:p>{foobar}</container:p>', '<container:p></container:p>', 'foobar', true );
 		} );
 
 		it( 'should remove part of the text node (as item)', () => {
-			test( '<container:p>f{oob}ar</container:p>', '<container:p>far</container:p>', 'oob', true );
+			testRemove( '<container:p>f{oob}ar</container:p>', '<container:p>far</container:p>', 'oob', true );
 		} );
 
 		it( 'should merge after removing (as item)', () => {
-			test(
+			testRemove(
 				'<container:p>' +
 					'<attribute:b view-priority="1">foo</attribute:b>[bar]<attribute:b view-priority="1">bazqux</attribute:b>' +
 				'</container:p>',
@@ -184,7 +184,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove EmptyElement (as item)', () => {
-			test(
+			testRemove(
 				'<container:p>foo[<empty:img></empty:img>]bar</container:p>',
 				'<container:p>foobar</container:p>',
 				'<empty:img></empty:img>',
@@ -193,7 +193,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should remove UIElement (as item)', () => {
-			test(
+			testRemove(
 				'<container:p>foo[<ui:span></ui:span>]bar</container:p>',
 				'<container:p>foobar</container:p>',
 				'<ui:span></ui:span>',

+ 30 - 30
packages/ckeditor5-engine/tests/view/downcastwriter/unwrap.js

@@ -27,7 +27,7 @@ describe( 'DowncastWriter', () => {
 		// @param {String} input
 		// @param {String} unwrapAttribute
 		// @param {String} expected
-		function test( input, unwrapAttribute, expected ) {
+		function testUnwrap( input, unwrapAttribute, expected ) {
 			const { view, selection } = parse( input );
 
 			const newRange = writer.unwrap( selection.getFirstRange(), parse( unwrapAttribute ) );
@@ -40,7 +40,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should do nothing on collapsed ranges', () => {
-			test(
+			testUnwrap(
 				'<container:p>f{}oo</container:p>',
 				'<attribute:b view-priority="10"></attribute:b>',
 				'<container:p>f{}oo</container:p>'
@@ -48,7 +48,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should do nothing on single text node', () => {
-			test(
+			testUnwrap(
 				'<container:p>[foobar]</container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>[foobar]</container:p>'
@@ -92,7 +92,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap single node', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1">foobar</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>[foobar]</container:p>'
@@ -100,7 +100,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not unwrap attributes with different priorities #1', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1">foobar</attribute:b>]</container:p>',
 				'<attribute:b view-priority="2"></attribute:b>',
 				'<container:p>[<attribute:b view-priority="1">foobar</attribute:b>]</container:p>'
@@ -108,7 +108,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not unwrap attributes with different priorities #2', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 				'[' +
 					'<attribute:b view-priority="2">foo</attribute:b>' +
@@ -122,7 +122,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap part of the node', () => {
-			test(
+			testUnwrap(
 				'<container:p>[baz<attribute:b view-priority="1">foo}bar</attribute:b></container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>[bazfoo]<attribute:b view-priority="1">bar</attribute:b></container:p>'
@@ -130,7 +130,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should support unicode', () => {
-			test(
+			testUnwrap(
 				'<container:p>[நிலை<attribute:b view-priority="1">க்}கு</attribute:b></container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>[நிலைக்]<attribute:b view-priority="1">கு</attribute:b></container:p>'
@@ -138,7 +138,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap nested attributes', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:u view-priority="1"><attribute:b view-priority="1">foobar</attribute:b></attribute:u>]' +
 				'</container:p>',
@@ -148,7 +148,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap a part of a nested attribute', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'<attribute:u view-priority="1"><attribute:b view-priority="1">fo{ob}ar</attribute:b></attribute:u>' +
 				'</container:p>',
@@ -164,7 +164,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should merge unwrapped nodes #1', () => {
-			test(
+			testUnwrap(
 				'<container:p>foo[<attribute:b view-priority="1">bar</attribute:b>]baz</container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>foo{bar}baz</container:p>'
@@ -184,7 +184,7 @@ describe( 'DowncastWriter', () => {
 			const attribute = '<attribute:b view-priority="1"></attribute:b>';
 			const result = '<container:p>foo<attribute:u view-priority="1">bar{bazqux</attribute:u>]</container:p>';
 
-			test( input, attribute, result );
+			testUnwrap( input, attribute, result );
 		} );
 
 		it( 'should merge unwrapped nodes #3', () => {
@@ -205,7 +205,7 @@ describe( 'DowncastWriter', () => {
 				'</attribute:b>' +
 			'</container:p>';
 
-			test( input, attribute, result );
+			testUnwrap( input, attribute, result );
 		} );
 
 		it( 'should merge unwrapped nodes #4', () => {
@@ -225,7 +225,7 @@ describe( 'DowncastWriter', () => {
 				'<attribute:u view-priority="1">bar{baz}qux</attribute:u>' +
 			'</container:p>';
 
-			test( input, attribute, result );
+			testUnwrap( input, attribute, result );
 		} );
 
 		it( 'should merge unwrapped nodes #5', () => {
@@ -239,7 +239,7 @@ describe( 'DowncastWriter', () => {
 			const attribute = '<attribute:b view-priority="1"></attribute:b>';
 			const result = '<container:p>[<attribute:u view-priority="1">foobarbaz</attribute:u>]</container:p>';
 
-			test( input, attribute, result );
+			testUnwrap( input, attribute, result );
 		} );
 
 		it( 'should unwrap mixed ranges #1', () => {
@@ -252,11 +252,11 @@ describe( 'DowncastWriter', () => {
 			const attribute = '<attribute:b view-priority="1"></attribute:b>';
 			const result = '<container:p>[<attribute:u view-priority="1">foo</attribute:u>]</container:p>';
 
-			test( input, attribute, result );
+			testUnwrap( input, attribute, result );
 		} );
 
 		it( 'should unwrap mixed ranges #2', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:u view-priority="1"><attribute:b view-priority="1">foo}</attribute:b></attribute:u>' +
 				'</container:p>',
@@ -266,7 +266,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap single element by removing matching attributes', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1" foo="bar" baz="qux">test</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1" baz="qux"></attribute:b>',
 				'<container:p>[<attribute:b view-priority="1" foo="bar">test</attribute:b>]</container:p>'
@@ -274,7 +274,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not unwrap single element when attributes are different', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1" baz="qux" foo="bar">test</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1" baz="qux" test="true"></attribute:b>',
 				'<container:p>[<attribute:b view-priority="1" baz="qux" foo="bar">test</attribute:b>]</container:p>'
@@ -282,7 +282,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap single element by removing matching classes', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1" class="bar baz foo">test</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1" class="baz foo"></attribute:b>',
 				'<container:p>[<attribute:b view-priority="1" class="bar">test</attribute:b>]</container:p>'
@@ -290,7 +290,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not unwrap single element when classes are different', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1" class="bar baz foo">test</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1" class="baz foo qux"></attribute:b>',
 				'<container:p>[<attribute:b view-priority="1" class="bar baz foo">test</attribute:b>]</container:p>'
@@ -298,7 +298,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap single element by removing matching styles', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:b view-priority="1" style="color:red;position:absolute;top:10px;">test</attribute:b>]' +
 				'</container:p>',
@@ -308,7 +308,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should not unwrap single element when styles are different', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:b view-priority="1" style="color:red;position:absolute;top:10px">test</attribute:b>]' +
 				'</container:p>',
@@ -320,7 +320,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should partially unwrap part of a node', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:b view-priority="1" baz="qux" foo="bar">foo}bar</attribute:b>' +
 				'</container:p>',
@@ -333,7 +333,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should partially unwrap a nested attribute', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'[<attribute:i view-priority="1">' +
 						'<attribute:b view-priority="1" style="color:red;position:absolute;top:10px;">test</attribute:b>' +
@@ -349,7 +349,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should partially unwrap a part of a nested attribute', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'<attribute:i view-priority="1">' +
 						'<attribute:b view-priority="1" style="color:red;position:absolute;top:10px;">t{es}t</attribute:b>' +
@@ -367,7 +367,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should be merged after being partially unwrapped', () => {
-			test(
+			testUnwrap(
 				'<container:p>' +
 					'<attribute:b view-priority="1" baz="qux">xyz</attribute:b>' +
 					'[<attribute:b view-priority="1" baz="qux" foo="bar">foo}bar</attribute:b>' +
@@ -381,7 +381,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap single node in document fragment', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b view-priority="1">foobar</attribute:b>]</container:p>',
 				'<attribute:b view-priority="1"></attribute:b>',
 				'<container:p>[foobar]</container:p>'
@@ -389,7 +389,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap EmptyElement', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b><empty:img></empty:img></attribute:b>]</container:p>',
 				'<attribute:b></attribute:b>',
 				'<container:p>[<empty:img></empty:img>]</container:p>'
@@ -408,7 +408,7 @@ describe( 'DowncastWriter', () => {
 		} );
 
 		it( 'should unwrap UIElement', () => {
-			test(
+			testUnwrap(
 				'<container:p>[<attribute:b><ui:span></ui:span></attribute:b>]</container:p>',
 				'<attribute:b></attribute:b>',
 				'<container:p>[<ui:span></ui:span>]</container:p>'

+ 46 - 46
packages/ckeditor5-engine/tests/view/downcastwriter/wrap.js

@@ -38,7 +38,7 @@ describe( 'DowncastWriter', () => {
 			 * @param {String} wrapAttribute
 			 * @param {String} expected
 			 */
-			function test( input, wrapAttribute, expected ) {
+			function testWrap( input, wrapAttribute, expected ) {
 				const { view, selection } = parse( input );
 				const newRange = writer.wrap( selection.getFirstRange(), parse( wrapAttribute ) );
 
@@ -47,7 +47,7 @@ describe( 'DowncastWriter', () => {
 			}
 
 			it( 'wraps single text node', () => {
-				test(
+				testWrap(
 					'<container:p>[foobar]</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>[<attribute:b view-priority="1">foobar</attribute:b>]</container:p>'
@@ -55,7 +55,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'wraps single text node in document fragment', () => {
-				test(
+				testWrap(
 					'{foobar}',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'[<attribute:b view-priority="1">foobar</attribute:b>]'
@@ -99,7 +99,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'wraps part of a single text node #1', () => {
-				test(
+				testWrap(
 					'<container:p>[foo}bar</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>[<attribute:b view-priority="1">foo</attribute:b>]bar</container:p>'
@@ -107,7 +107,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'wraps part of a single text node #2', () => {
-				test(
+				testWrap(
 					'<container:p>{foo}bar</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>[<attribute:b view-priority="1">foo</attribute:b>]bar</container:p>'
@@ -115,7 +115,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should support unicode', () => {
-				test(
+				testWrap(
 					'<container:p>நி{லை}க்கு</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>நி[<attribute:b view-priority="1">லை</attribute:b>]க்கு</container:p>'
@@ -123,7 +123,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should join wrapping element with a nested attribute element', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'<attribute:u view-priority="1">' +
 							'<attribute:b view-priority="2" class="bar">{foo}</attribute:b>' +
@@ -141,7 +141,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should join wrapping element with a part of a nested attribute element', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'<attribute:i view-priority="1">' +
 							'<attribute:b view-priority="2" class="bar">fo{ob}ar</attribute:b>' +
@@ -161,7 +161,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'wraps part of a single text node #3', () => {
-				test(
+				testWrap(
 					'<container:p>foo{bar}</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>foo[<attribute:b view-priority="1">bar</attribute:b>]</container:p>'
@@ -169,7 +169,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not wrap inside nested containers', () => {
-				test(
+				testWrap(
 					'<container:div>[foobar<container:p>baz</container:p>]</container:div>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:div>[<attribute:b view-priority="1">foobar</attribute:b><container:p>baz</container:p>]</container:div>'
@@ -177,7 +177,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'wraps according to priorities', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:u view-priority="1">foobar</attribute:u>]</container:p>',
 
 					'<attribute:b view-priority="2"></attribute:b>',
@@ -189,7 +189,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #1', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'[<attribute:b view-priority="1">foo</attribute:b>bar<attribute:b view-priority="1">baz</attribute:b>]' +
 					'</container:p>',
@@ -201,7 +201,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #2', () => {
-				test(
+				testWrap(
 					'<container:p><attribute:b view-priority="1">foo</attribute:b>[bar}baz</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">foo{bar</attribute:b>]baz</container:p>'
@@ -209,7 +209,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #3', () => {
-				test(
+				testWrap(
 					'<container:p><attribute:b view-priority="1">foobar</attribute:b>[baz]</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">foobar{baz</attribute:b>]</container:p>'
@@ -217,7 +217,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #4', () => {
-				test(
+				testWrap(
 					'<container:p>[foo<attribute:i view-priority="1">bar</attribute:i>]baz</container:p>',
 
 					'<attribute:b view-priority="1"></attribute:b>',
@@ -229,7 +229,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #5', () => {
-				test(
+				testWrap(
 					'<container:p>[foo<attribute:i view-priority="1">bar</attribute:i>baz]</container:p>',
 
 					'<attribute:b view-priority="2"></attribute:b>',
@@ -247,7 +247,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'merges wrapped nodes #6', () => {
-				test(
+				testWrap(
 					'<container:div>f{o<attribute:strong>ob</attribute:strong>a}r</container:div>',
 
 					'<attribute:span view-priority="1"></attribute:span>',
@@ -261,7 +261,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap single element by merging attributes', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:b view-priority="1" foo="bar" one="two"></attribute:b>]</container:p>',
 					'<attribute:b view-priority="1" baz="qux" one="two"></attribute:b>',
 					'<container:p>[<attribute:b view-priority="1" baz="qux" foo="bar" one="two"></attribute:b>]</container:p>'
@@ -269,7 +269,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not merge attributes when they differ', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:b view-priority="1" foo="bar">text</attribute:b>]</container:p>',
 
 					'<attribute:b view-priority="1" foo="baz"></attribute:b>',
@@ -283,7 +283,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap single element by merging classes', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:b view-priority="1" class="foo bar baz"></attribute:b>]</container:p>',
 					'<attribute:b view-priority="1" class="foo bar qux jax"></attribute:b>',
 					'<container:p>[<attribute:b view-priority="1" class="bar baz foo jax qux"></attribute:b>]</container:p>'
@@ -291,7 +291,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap single element by merging styles', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'[<attribute:b view-priority="1" style="color:red; position: absolute"></attribute:b>]' +
 					'</container:p>',
@@ -305,7 +305,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not merge styles when they differ', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:b view-priority="1" style="color:red"></attribute:b>]</container:p>',
 
 					'<attribute:b view-priority="1" style="color:black"></attribute:b>',
@@ -321,7 +321,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not merge single elements when they have different priority', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:b view-priority="2" style="color:red"></attribute:b>]</container:p>',
 
 					'<attribute:b view-priority="1" style="color:red"></attribute:b>',
@@ -337,7 +337,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should be merged with outside element when wrapping all children', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'<attribute:b view-priority="1" foo="bar">[foobar<attribute:i view-priority="1">baz</attribute:i>]</attribute:b>' +
 					'</container:p>',
@@ -356,7 +356,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should be merged with broken element', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'[<attribute:b view-priority="1" foo="bar">foo}bar</attribute:b>' +
 					'</container:p>',
@@ -371,7 +371,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should be merged with broken element and merged with siblings', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'<attribute:b view-priority="1" baz="qux" foo="bar">xyz</attribute:b>' +
 						'[<attribute:b view-priority="1" foo="bar">foo}bar</attribute:b>' +
@@ -387,7 +387,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap EmptyElement', () => {
-				test(
+				testWrap(
 					'<container:p>[<empty:img></empty:img>]</container:p>',
 					'<attribute:b></attribute:b>',
 					'<container:p>[<attribute:b view-priority="10"><empty:img></empty:img></attribute:b>]</container:p>'
@@ -405,7 +405,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap UIElement', () => {
-				test(
+				testWrap(
 					'<container:p>[<ui:span></ui:span>]</container:p>',
 					'<attribute:b></attribute:b>',
 					'<container:p>[<attribute:b view-priority="10"><ui:span></ui:span></attribute:b>]</container:p>'
@@ -423,7 +423,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should keep stable hierarchy when wrapping with attribute with same priority', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:span>foo</attribute:span>]</container:p>',
 
 					'<attribute:b></attribute:b>',
@@ -435,7 +435,7 @@ describe( 'DowncastWriter', () => {
 					'</container:p>'
 				);
 
-				test(
+				testWrap(
 					'<container:p>[<attribute:b>foo</attribute:b>]</container:p>',
 
 					'<attribute:span></attribute:span>',
@@ -449,7 +449,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should keep stable hierarchy when wrapping with attribute with same priority that can\'t be merged', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:span name="foo">foo</attribute:span>]</container:p>',
 
 					'<attribute:span name="bar"></attribute:span>',
@@ -461,7 +461,7 @@ describe( 'DowncastWriter', () => {
 					'</container:p>'
 				);
 
-				test(
+				testWrap(
 					'<container:p>[<attribute:span name="bar">foo</attribute:span>]</container:p>',
 
 					'<attribute:span name="foo"></attribute:span>',
@@ -475,7 +475,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not join elements if element to wrap has id', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:span foo="foo" view-id="foo">xyz</attribute:span>]</container:p>',
 
 					'<attribute:span bar="bar"></attribute:span>',
@@ -489,7 +489,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not join elements if wrapper element has id', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:span foo="foo">xyz</attribute:span>]</container:p>',
 
 					'<attribute:span bar="bar" view-id="foo"></attribute:span>',
@@ -503,7 +503,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should not join elements if they have different ids', () => {
-				test(
+				testWrap(
 					'<container:p>[<attribute:span foo="foo" view-id="foo">xyz</attribute:span>]</container:p>',
 
 					'<attribute:span bar="bar" view-id="bar"></attribute:span>',
@@ -537,7 +537,7 @@ describe( 'DowncastWriter', () => {
 			 * @param {String} wrapAttribute
 			 * @param {String} expected
 			 */
-			function test( input, wrapAttribute, expected ) {
+			function testWrap( input, wrapAttribute, expected ) {
 				const { view, selection } = parse( input, { rootElement: viewRoot } );
 				viewDocument.selection._setTo( selection );
 
@@ -560,7 +560,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap position at the beginning of text node', () => {
-				test(
+				testWrap(
 					'<container:p>{}foobar</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">[]</attribute:b>foobar</container:p>'
@@ -568,7 +568,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap position inside text node', () => {
-				test(
+				testWrap(
 					'<container:p>foo{}bar</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>foo<attribute:b view-priority="1">[]</attribute:b>bar</container:p>'
@@ -576,7 +576,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should support unicode', () => {
-				test(
+				testWrap(
 					'<container:p>நிலை{}க்கு</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>நிலை<attribute:b view-priority="1">[]</attribute:b>க்கு</container:p>'
@@ -584,7 +584,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap position inside document fragment', () => {
-				test(
+				testWrap(
 					'<attribute:b view-priority="1">foo</attribute:b>[]<attribute:b view-priority="3">bar</attribute:b>',
 
 					'<attribute:b view-priority="2"></attribute:b>',
@@ -596,7 +596,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap position at the end of text node', () => {
-				test(
+				testWrap(
 					'<container:p>foobar{}</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p>foobar<attribute:b view-priority="1">[]</attribute:b></container:p>'
@@ -604,7 +604,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should merge with existing attributes #1', () => {
-				test(
+				testWrap(
 					'<container:p><attribute:b view-priority="1">foo</attribute:b>[]</container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">foo{}</attribute:b></container:p>'
@@ -612,7 +612,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should merge with existing attributes #2', () => {
-				test(
+				testWrap(
 					'<container:p>[]<attribute:b view-priority="1">foo</attribute:b></container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">{}foo</attribute:b></container:p>'
@@ -620,7 +620,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should wrap when inside nested attributes', () => {
-				test(
+				testWrap(
 					'<container:p><attribute:b view-priority="1">foo{}bar</attribute:b></container:p>',
 
 					'<attribute:u view-priority="1"></attribute:u>',
@@ -636,7 +636,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should merge when wrapping between same attribute', () => {
-				test(
+				testWrap(
 					'<container:p>' +
 						'<attribute:b view-priority="1">foo</attribute:b>[]<attribute:b view-priority="1">bar</attribute:b>' +
 					'</container:p>',
@@ -648,7 +648,7 @@ describe( 'DowncastWriter', () => {
 			} );
 
 			it( 'should move position to text node if in same attribute', () => {
-				test(
+				testWrap(
 					'<container:p><attribute:b view-priority="1">foobar[]</attribute:b></container:p>',
 					'<attribute:b view-priority="1"></attribute:b>',
 					'<container:p><attribute:b view-priority="1">foobar{}</attribute:b></container:p>'

+ 1 - 1
packages/ckeditor5-engine/tests/view/filler.js

@@ -10,7 +10,7 @@ import {
 	INLINE_FILLER,
 	startsWithFiller,
 	isInlineFiller,
-	getDataWithoutFiller,
+	getDataWithoutFiller
 } from '../../src/view/filler';
 
 describe( 'filler', () => {

+ 2 - 2
packages/ckeditor5-engine/tests/view/observer/fakeselectionobserver.js

@@ -157,7 +157,7 @@ describe( 'FakeSelectionObserver', () => {
 		return new Promise( resolve => {
 			const data = {
 				keyCode,
-				preventDefault: sinon.spy(),
+				preventDefault: sinon.spy()
 			};
 
 			viewDocument.once( 'keydown', () => {
@@ -203,7 +203,7 @@ describe( 'FakeSelectionObserver', () => {
 
 		const data = {
 			keyCode,
-			preventDefault: sinon.spy(),
+			preventDefault: sinon.spy()
 		};
 
 		viewDocument.fire( 'keydown', new DomEventData( viewDocument, { target: document.body }, data ) );

+ 6 - 6
packages/ckeditor5-engine/tests/view/position.js

@@ -603,28 +603,28 @@ describe( 'Position', () => {
 			const afterLoremPosition = new Position( liOl1, 5 );
 			const otherPosition = Position._createAt( afterLoremPosition );
 
-			test( afterLoremPosition, otherPosition, liOl1 );
+			testParent( afterLoremPosition, otherPosition, liOl1 );
 		} );
 
 		it( 'for two positions in the same element returns the element', () => {
 			const startMaecenasPosition = Position._createAt( liOl2, 0 );
 			const beforeTellusPosition = new Position( liOl2, 18 );
 
-			test( startMaecenasPosition, beforeTellusPosition, liOl2 );
+			testParent( startMaecenasPosition, beforeTellusPosition, liOl2 );
 		} );
 
 		it( 'works when one of the positions is nested deeper than the other #1', () => {
 			const firstPosition = new Position( liUl1, 1 );
 			const secondPosition = new Position( p, 3 );
 
-			test( firstPosition, secondPosition, div );
+			testParent( firstPosition, secondPosition, div );
 		} );
 
 		it( 'works when one of the positions is nested deeper than the other #2', () => {
 			const firstPosition = new Position( liOl2, 10 );
 			const secondPosition = new Position( section, 1 );
 
-			test( firstPosition, secondPosition, section );
+			testParent( firstPosition, secondPosition, section );
 		} );
 
 		it( 'for two positions in different trees returns null', () => {
@@ -632,10 +632,10 @@ describe( 'Position', () => {
 			const posInDiv = new Position( div, 0 );
 			const firstPosition = new Position( liOl2, 10 );
 
-			test( posInDiv, firstPosition, null );
+			testParent( posInDiv, firstPosition, null );
 		} );
 
-		function test( positionA, positionB, lca ) {
+		function testParent( positionA, positionB, lca ) {
 			expect( positionA.getCommonAncestor( positionB ) ).to.equal( lca );
 			expect( positionB.getCommonAncestor( positionA ) ).to.equal( lca );
 		}

+ 1 - 1
packages/ckeditor5-engine/tests/view/styles/utils.js

@@ -89,7 +89,7 @@ describe( 'Styles utils', () => {
 				'rgba(1,2,3,0.7',
 				'rgba((1,2,3,0.7',
 				'rgba(1,a,3,0.7)',
-				'rgba(1,2,3,*)',
+				'rgba(1,2,3,*)'
 			], value => !isColor( value ) );
 		} );