From 381d0c7fcd743fc8e3f6f9a0b29826c333c24e87 Mon Sep 17 00:00:00 2001 From: iseulde Date: Wed, 24 Oct 2018 12:38:09 +0200 Subject: [PATCH] Fix failing e2e test --- packages/rich-text/src/test/to-dom.js | 1 + packages/rich-text/src/to-dom.js | 9 ++++----- .../__snapshots__/deprecated-node-matcher.test.js.snap | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/rich-text/src/test/to-dom.js b/packages/rich-text/src/test/to-dom.js index 9f5a7b076d844..41be951ea9d1e 100644 --- a/packages/rich-text/src/test/to-dom.js +++ b/packages/rich-text/src/test/to-dom.js @@ -29,6 +29,7 @@ describe( 'recordToDom', () => { value: record, multilineTag, multilineWrapperTags, + createLinePadding: ( doc ) => doc.createElement( 'br' ), } ); expect( body ).toMatchSnapshot(); expect( selection ).toEqual( { startPath, endPath } ); diff --git a/packages/rich-text/src/to-dom.js b/packages/rich-text/src/to-dom.js index 9a48db5467b63..7ca94ea27830f 100644 --- a/packages/rich-text/src/to-dom.js +++ b/packages/rich-text/src/to-dom.js @@ -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; @@ -158,7 +155,9 @@ export function toDom( { }, } ); - padEmptyLines( { element: tree, createLinePadding } ); + if ( createLinePadding ) { + padEmptyLines( { element: tree, createLinePadding } ); + } return { body: tree, diff --git a/test/e2e/specs/__snapshots__/deprecated-node-matcher.test.js.snap b/test/e2e/specs/__snapshots__/deprecated-node-matcher.test.js.snap index a0cc53a6c1811..d36c990c04c37 100644 --- a/test/e2e/specs/__snapshots__/deprecated-node-matcher.test.js.snap +++ b/test/e2e/specs/__snapshots__/deprecated-node-matcher.test.js.snap @@ -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`] = ` " -

test


+

test

" `;