article-json-html-render
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -17,6 +17,9 @@ 'use strict'; | ||
render: function render(_ref2) { | ||
var items = _ref2.props.items; | ||
var _ref2$props = _ref2.props; | ||
var items = _ref2$props.items; | ||
var _ref2$props$articlePr = _ref2$props.articleProps; | ||
var articleProps = _ref2$props$articlePr === undefined ? {} : _ref2$props$articlePr; | ||
return (0, _magicVirtualElement2.default)( | ||
'article', | ||
null, | ||
articleProps, | ||
blockList(items) | ||
@@ -23,0 +26,0 @@ ); |
import element from 'magic-virtual-element'; | ||
const setup = ({blockList}) => ({ | ||
render: ({props: {items}}) => <article>{blockList(items)}</article> | ||
render: ({props: {items, articleProps = {}}}) => <article {...articleProps}>{blockList(items)}</article> | ||
}); | ||
export default setup; |
{ | ||
"name": "article-json-html-render", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Base for html-based article-json renderer, such as [article-json-to-amp](https://www.npmjs.com/package/article-json-to-amp)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
14
test.js
@@ -559,1 +559,15 @@ import test from 'tape'; | ||
}); | ||
test('articleProps', t => { | ||
const Article = setupArticle({ embeds: {} }); | ||
const articleProps = { | ||
contenteditable: true, | ||
class: 'custom-article-class' | ||
}; | ||
const expected = renderString(tree(<article {...articleProps}></article>)); | ||
const actual = renderString(tree(<Article articleProps={articleProps} items={[]} />)); | ||
t.equal(actual, expected); | ||
t.end(); | ||
}); |
37587
1088