From 7f8408e1adc01fe0fbe4301e61421805594d7d83 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Tue, 13 Nov 2018 14:33:00 +0100 Subject: [PATCH 1/2] "getFillerOffset()" util from ContainerElement is exported in order to use in other place of the code. --- src/view/containerelement.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/view/containerelement.js b/src/view/containerelement.js index 5169c10d5..761a45dd7 100644 --- a/src/view/containerelement.js +++ b/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 ]; From 56b71cfe1300a4a0331df92edd3e1e5036819fdf Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Tue, 13 Nov 2018 15:51:12 +0100 Subject: [PATCH 2/2] Added missing test. --- tests/view/containerelement.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/view/containerelement.js b/tests/view/containerelement.js index d3a29dc1d..ddc8552d5 100644 --- a/tests/view/containerelement.js +++ b/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' ); + } ); +} );