Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-lorem-component

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lorem-component - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

18

index.js

@@ -12,3 +12,6 @@ "use strict";

getDefaultProps: function() {
return { count: 5, seed: 0 };
return {
mode: "paragraphs", count: 5,
seed: 0, ordered: false
};
},

@@ -26,5 +29,16 @@

var html = loremIpsum(options);
var wrapper = React.DOM.div;
if (this.props.mode === "list") {
html = html.replace(/<p>(.*?)<\/p>/g, "<li>$1</li>");
if (this.props.ordered === true) {
wrapper = React.DOM.ol;
} else {
wrapper = React.DOM.ul;
}
}
return this.transferPropsTo(
React.DOM.div({ dangerouslySetInnerHTML: { __html: html } })
wrapper({ dangerouslySetInnerHTML: { __html: html } })
);

@@ -31,0 +45,0 @@ }

2

package.json
{
"name": "react-lorem-component",
"version": "0.4.0",
"version": "0.5.0",
"description": "A component for React that renders paragraph tags full of lorem ipsum text",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,20 +0,48 @@

var assert = require("assert");
var React = require("react");
var LoremIpsum = require("./index");
var assert = require('assert');
var React = require('react');
var LoremIpsum = require('./index');
describe("react-lorem-component", function() {
it("renders lorem ipsum text", function() {
var component = LoremIpsum({
count: 2,
words: ["foo"],
sentenceLowerBound: 3,
sentenceUpperBound: 3,
paragraphLowerBound: 2,
paragraphUpperBound: 2
describe('react-lorem-component', function() {
it('transfers properties', function() {
React.renderComponentToString(LoremIpsum({ className: "lorem-ipsum" }), function(markup) {
assert(/^<div [^>]*?class="lorem-ipsum"/.test(markup));
});
});
React.renderComponentToString(component, function(markup) {
assert(/<p>Foo foo foo. Foo foo foo.<\/p><p>Foo foo foo. Foo foo foo.<\/p>/.test(markup));
describe('by default', function() {
it('renders lorem ipsum paragraphs wrapped in a DIV tag', function() {
var component = LoremIpsum({
count: 2,
words: ['foo'],
sentenceLowerBound: 3,
sentenceUpperBound: 3,
paragraphLowerBound: 2,
paragraphUpperBound: 2
});
React.renderComponentToString(component, function(markup) {
assert(/^<div [^>]+><p>Foo foo foo. Foo foo foo.<\/p><p>Foo foo foo. Foo foo foo.<\/p><\/div>$/.test(markup));
});
});
});
describe('with `mode` property set to "list"', function() {
it('renders lorem ipsum list items wrapped in an UL tag', function() {
var component = LoremIpsum({ count: 2, mode: 'list' });
React.renderComponentToString(component, function(markup) {
assert(/^<ul [^>]+><li>.+<\/li><\/ul>$/.test(markup));
});
});
describe('and with `ordered` property set to `true`', function() {
it('renders lorem ipsum list items wrapped in an OL tag', function() {
var component = LoremIpsum({ count: 2, mode: 'list', ordered: true });
React.renderComponentToString(component, function(markup) {
assert(/^<ol [^>]+><li>.+<\/li><\/ol>$/.test(markup));
});
});
});
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc