Skip to content

Commit

Permalink
Merge pull request #14253 from ckeditor/ck/13928-make-bodyCollectionC…
Browse files Browse the repository at this point in the history
…ontainer-public

Feature (ui): `BodyCollection.bodyCollectionContainer` made public property. Closes #13928.
  • Loading branch information
niegowski committed May 26, 2023
2 parents f7aff11 + fc0f3bb commit 1f5c8d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packages/ckeditor5-ui/src/editorui/bodycollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export default class BodyCollection extends ViewCollection {
this.locale = locale;
}

/**
* The element holding elements of the body region.
*/
public get bodyCollectionContainer(): HTMLElement | undefined {
return this._bodyCollectionContainer;
}

/**
* Attaches the body collection to the DOM body element. You need to execute this method to render the content of
* the body collection.
Expand Down
10 changes: 5 additions & 5 deletions packages/ckeditor5-ui/tests/editorui/bodycollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe( 'BodyCollection', () => {
expect( wrappers.length ).to.equal( 1 );
expect( wrappers[ 0 ].parentNode ).to.equal( document.body );

const el = body._bodyCollectionContainer;
const el = body.bodyCollectionContainer;

expect( el.parentNode ).to.equal( wrappers[ 0 ] );
expect( el.classList.contains( 'ck' ) ).to.be.true;
Expand All @@ -70,7 +70,7 @@ describe( 'BodyCollection', () => {

body.attachToDom();

const el = body._bodyCollectionContainer;
const el = body.bodyCollectionContainer;

expect( el.getAttribute( 'dir' ) ).to.equal( 'ltr' );
} );
Expand All @@ -81,7 +81,7 @@ describe( 'BodyCollection', () => {

body.attachToDom();

const el = body._bodyCollectionContainer;
const el = body.bodyCollectionContainer;

expect( el.getAttribute( 'dir' ) ).to.equal( 'rtl' );
} );
Expand Down Expand Up @@ -137,8 +137,8 @@ describe( 'BodyCollection', () => {
expect( wrappers.length ).to.equal( 1 );

const wrapper = wrappers[ 0 ];
const body1Element = body1._bodyCollectionContainer;
const body2Element = body2._bodyCollectionContainer;
const body1Element = body1.bodyCollectionContainer;
const body2Element = body2.bodyCollectionContainer;

expect( body1Element.parentNode ).to.equal( wrapper );
expect( body1Element.childNodes.length ).to.equal( 1 );
Expand Down

0 comments on commit 1f5c8d0

Please sign in to comment.