Socket
Socket
Sign inDemoInstall

article-json-html-render

Package Overview
Dependencies
12
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

3

dist/components/embed.js

@@ -26,2 +26,3 @@ 'use strict';

var caption = props.caption;
var figureProps = props.figureProps;

@@ -34,3 +35,3 @@ var embed = embeds[embedType] && embeds[embedType](props);

'figure',
null,
figureProps,
embed,

@@ -37,0 +38,0 @@ captionElm

@@ -7,3 +7,3 @@ import {element} from 'deku';

render: ({props}) => {
const {embedType, caption} = props;
const {embedType, caption, figureProps} = props;
const embed = embeds[embedType] && embeds[embedType](props);

@@ -14,3 +14,3 @@

return <figure>{embed}{captionElm}</figure>;
return <figure {...figureProps}>{embed}{captionElm}</figure>;
}

@@ -17,0 +17,0 @@ });

{
"name": "article-json-html-render",
"version": "1.0.0",
"version": "1.1.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",

@@ -46,2 +46,33 @@ import test from 'tape';

test('embed with custom figureProps', t => {
t.plan(2);
const Article = setupArticle({
embeds: {
twitter: tweet => {
t.equal(tweet.id, 'twitter-id');
return <span id={tweet.id} />;
}
}
});
const items = [{
type: 'embed',
embedType: 'twitter',
id: 'twitter-id',
figureProps: {
foo: 'bar',
hello: 'world'
}
}];
const expected = string.render(
<article>
<figure foo='bar' hello='world'><span id='twitter-id'/></figure>
</article>);
const actual = string.render(<Article items={items} />);
t.equal(actual, expected);
t.end();
});
test('text elements', t => {

@@ -48,0 +79,0 @@ const Article = setupArticle({ embeds: {} });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc