Skip to content

Commit

Permalink
Fix failing e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Oct 24, 2018
1 parent 3c37ef7 commit 381d0c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/rich-text/src/test/to-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe( 'recordToDom', () => {
value: record,
multilineTag,
multilineWrapperTags,
createLinePadding: ( doc ) => doc.createElement( 'br' ),
} );
expect( body ).toMatchSnapshot();
expect( selection ).toEqual( { startPath, endPath } );
Expand Down
9 changes: 4 additions & 5 deletions packages/rich-text/src/to-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ function remove( node ) {
return node.parentNode.removeChild( node );
}

function padEmptyLines( {
element,
createLinePadding = ( doc ) => doc.createElement( 'br' ),
} ) {
function padEmptyLines( { element, createLinePadding } ) {
const length = element.childNodes.length;
const doc = element.ownerDocument;

Expand Down Expand Up @@ -158,7 +155,9 @@ export function toDom( {
},
} );

padEmptyLines( { element: tree, createLinePadding } );
if ( createLinePadding ) {
padEmptyLines( { element: tree, createLinePadding } );
}

return {
body: tree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ exports[`Deprecated Node Matcher should insert block with children source 1`] =
exports[`Deprecated Node Matcher should insert block with node source 1`] = `
"<!-- wp:deprecated-node-matcher -->
<blockquote class=\\"wp-block-deprecated-node-matcher\\"><p>test</p><p><br data-mce-bogus=\\"1\\"/></p></blockquote>
<blockquote class=\\"wp-block-deprecated-node-matcher\\"><p>test</p><p></p></blockquote>
<!-- /wp:deprecated-node-matcher -->"
`;

0 comments on commit 381d0c7

Please sign in to comment.