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

Commit

Permalink
Merge pull request #1591 from ckeditor/t/ckeditor5/1312
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Reinmar authored Nov 13, 2018
2 parents 412dc45 + 56b71cf commit 12f28bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
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' );
} );
} );

0 comments on commit 12f28bb

Please sign in to comment.