From 1784f25caaf6d0dc75917d3a874b7a63ac234494 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Fri, 22 Jul 2016 13:39:02 -0700 Subject: [PATCH] fix styles for void, fix tests for void rendering --- lib/components/void.js | 14 ++++++++------ .../fixtures/custom-block-void/index.js | 7 ++++++- .../fixtures/custom-block-void/output.html | 16 +++++++++------- test/rendering/index.js | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/components/void.js b/lib/components/void.js index 655067a4b..f595e00b2 100644 --- a/lib/components/void.js +++ b/lib/components/void.js @@ -21,6 +21,10 @@ class Void extends React.Component { style: React.PropTypes.object }; + static defaultProps = { + style: {} + } + shouldComponentUpdate = (props) => { return ( props.node != this.props.node || @@ -34,20 +38,18 @@ class Void extends React.Component { const Tag = node.kind == 'block' ? 'div' : 'span' // Make the outer wrapper relative, so the spacer can overlay it. - const relative = { + const styles = { + ...style, position: 'relative' } return ( - + {this.renderSpacer()} {children} diff --git a/test/rendering/fixtures/custom-block-void/index.js b/test/rendering/fixtures/custom-block-void/index.js index e508818c3..2b92a949b 100644 --- a/test/rendering/fixtures/custom-block-void/index.js +++ b/test/rendering/fixtures/custom-block-void/index.js @@ -1,8 +1,13 @@ +import { Void } from '../../../..' import React from 'react' function Image(props) { - return + return ( + + + + ) } export function renderNode(node) { diff --git a/test/rendering/fixtures/custom-block-void/output.html b/test/rendering/fixtures/custom-block-void/output.html index 591712d02..f31b16fd0 100644 --- a/test/rendering/fixtures/custom-block-void/output.html +++ b/test/rendering/fixtures/custom-block-void/output.html @@ -1,13 +1,15 @@
-
- - -
+
+
+ + +
+
- -
- +
+ +
diff --git a/test/rendering/index.js b/test/rendering/index.js index a14d7b336..9696da82e 100644 --- a/test/rendering/index.js +++ b/test/rendering/index.js @@ -54,7 +54,7 @@ function clean(html) { $(el).removeAttr('data-offset-key') }) - $('[contenteditable]').removeAttr('style') + $.root().children().removeAttr('style') return $.html() }