Forráskód Böngészése

Merge pull request #1591 from ckeditor/t/ckeditor5/1312

Other: `ContainerElement#getFillerOffset` can be now re-used in other places in the code (it was exported from the module). See ckeditor/ckeditor5-list#117.
Piotrek Koszuliński 7 éve
szülő
commit
d628ccdb4e

+ 6 - 4
packages/ckeditor5-engine/src/view/containerelement.js

@@ -62,10 +62,12 @@ export default class ContainerElement extends Element {
 	}
 }
 
-// Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.
-//
-// @returns {Number|null} Block filler offset or `null` if block filler is not needed.
-function getFillerOffset() {
+/**
+ * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.
+ *
+ * @returns {Number|null} Block filler offset or `null` if block filler is not needed.
+ */
+export function getFillerOffset() {
 	const children = [ ...this.getChildren() ];
 	const lastChild = children[ this.childCount - 1 ];
 

+ 7 - 1
packages/ckeditor5-engine/tests/view/containerelement.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-import ContainerElement from '../../src/view/containerelement';
+import { default as ContainerElement, getFillerOffset } from '../../src/view/containerelement';
 import Element from '../../src/view/element';
 import { parse } from '../../src/dev-utils/view';
 
@@ -96,3 +96,9 @@ describe( 'ContainerElement', () => {
 		} );
 	} );
 } );
+
+describe( 'getFillerOffset()', () => {
+	it( 'should be a function that can be used in other places', () => {
+		expect( getFillerOffset ).is.a( 'function' );
+	} );
+} );