Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

ContainerElement#getFillerOffset can be re-used in other places #1591

Merged
merged 2 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/view/containerelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
8 changes: 7 additions & 1 deletion tests/view/containerelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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' );
} );
} );