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

Commit

Permalink
Merge 70e6a4f into a00eb4a
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Feb 27, 2018
2 parents a00eb4a + 70e6a4f commit dfe047a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export function cleanList( evt, data, conversionApi ) {

for ( const child of children ) {
if ( !child.is( 'li' ) ) {
child.remove();
child._remove();
}
}
}
Expand All @@ -447,7 +447,7 @@ export function cleanListItem( evt, data, conversionApi ) {

for ( const child of children ) {
if ( foundList && !child.is( 'ul' ) && !child.is( 'ol' ) ) {
child.remove();
child._remove();
}

if ( child.is( 'text' ) ) {
Expand Down Expand Up @@ -779,7 +779,7 @@ export function modelIndentPasteFixer( evt, [ content, selection ] ) {
if ( indentChange > 0 ) {
// Adjust indent of all "first" list items in inserted data.
while ( item && item.is( 'listItem' ) ) {
item.setAttribute( 'indent', item.getAttribute( 'indent' ) + indentChange );
item._setAttribute( 'indent', item.getAttribute( 'indent' ) + indentChange );

item = item.nextSibling;
}
Expand All @@ -798,7 +798,7 @@ function generateLiInUl( modelItem, conversionApi ) {
const viewItem = createViewListItemElement();

const viewList = viewWriter.createContainerElement( listType, null );
viewList.appendChildren( viewItem );
viewList._appendChildren( viewItem );

mapper.bindElements( modelItem, viewItem );

Expand Down
10 changes: 5 additions & 5 deletions tests/listengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -3390,7 +3390,7 @@ describe( 'ListEngine', () => {
const uiElement = new ViewUIElement( 'span' );

// Append ui element at the end of first <li>.
viewDoc.getRoot().getChild( 0 ).getChild( 0 ).appendChildren( [ uiElement ] );
viewDoc.getRoot().getChild( 0 ).getChild( 0 )._appendChildren( [ uiElement ] );

expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span></li><li>Bar</li></ul>' );
Expand All @@ -3412,7 +3412,7 @@ describe( 'ListEngine', () => {
const uiElement = new ViewUIElement( 'span' );

// Append ui element at the end of first <li>.
viewRoot.getChild( 0 ).getChild( 0 ).appendChildren( [ uiElement ] );
viewRoot.getChild( 0 ).getChild( 0 )._appendChildren( [ uiElement ] );

expect( getViewData( editor.editing.view, { withoutSelection: true } ) )
.to.equal( '<ul><li>Foo<span></span></li><li>Bar<ul><li>Xxx</li><li>Yyy</li></ul></li></ul>' );
Expand Down Expand Up @@ -3440,7 +3440,7 @@ describe( 'ListEngine', () => {

it( 'ui element before <ul>', () => {
// Append ui element before <ul>.
viewRoot.insertChildren( 0, [ uiElement ] );
viewRoot._insertChildren( 0, [ uiElement ] );

model.change( writer => {
writer.remove( liFoo );
Expand All @@ -3452,7 +3452,7 @@ describe( 'ListEngine', () => {

it( 'ui element before first <li>', () => {
// Append ui element before <ul>.
viewRoot.getChild( 0 ).insertChildren( 0, [ uiElement ] );
viewRoot.getChild( 0 )._insertChildren( 0, [ uiElement ] );

model.change( writer => {
writer.remove( liFoo );
Expand All @@ -3464,7 +3464,7 @@ describe( 'ListEngine', () => {

it( 'ui element in the middle of list', () => {
// Append ui element before <ul>.
viewRoot.getChild( 0 ).insertChildren( 1, [ uiElement ] );
viewRoot.getChild( 0 )._insertChildren( 1, [ uiElement ] );

model.change( writer => {
writer.remove( liBar );
Expand Down
8 changes: 4 additions & 4 deletions tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ describe( 'utils', () => {

it( 'should return 0 if item has only lists as children', () => {
const innerListItem1 = createViewListItemElement();
innerListItem1.appendChildren( new ViewText( 'foo' ) );
innerListItem1._appendChildren( new ViewText( 'foo' ) );
const innerListItem2 = createViewListItemElement();
innerListItem2.appendChildren( new ViewText( 'bar' ) );
innerListItem2._appendChildren( new ViewText( 'bar' ) );
const innerList = new ViewContainerElement( 'ul', null, [ innerListItem1, innerListItem2 ] );
const outerListItem = createViewListItemElement();
outerListItem.appendChildren( innerList );
outerListItem._appendChildren( innerList );

expect( outerListItem.getFillerOffset() ).to.equal( 0 );
} );

it( 'should return null if item has non-list contents', () => {
const item = createViewListItemElement();
item.appendChildren( new ViewText( 'foo' ) );
item._appendChildren( new ViewText( 'foo' ) );

expect( item.getFillerOffset() ).to.be.null;
} );
Expand Down

0 comments on commit dfe047a

Please sign in to comment.