react-lorem-component
Advanced tools
Comparing version 0.5.3 to 0.6.1
/** @jsx React.DOM */ | ||
var React = require('react'); | ||
var ReactMount = require('react/lib/ReactMount'); | ||
var Lorem = require('../'); | ||
var React = require('react'); | ||
var Lorem = require('../'); | ||
ReactMount.allowFullPageRender = true; | ||
var App = React.createClass({ | ||
@@ -10,0 +7,0 @@ render: function() { |
var express = require('express'); | ||
var browserify = require('connect-browserify'); | ||
var reactify = require('reactify'); | ||
var React = require('react'); | ||
var render = require('react').renderComponentToString; | ||
@@ -13,9 +13,7 @@ require('node-jsx').install(); | ||
entry: __dirname + '/client', | ||
debug: true, watch: true, | ||
debug: true, watch: true, | ||
transforms: [reactify] | ||
})) | ||
.get('/', function(req, res, next) { | ||
React.renderComponentToString(App(), function(markup) { | ||
res.send(markup); | ||
}); | ||
res.send(render(App())); | ||
}) | ||
@@ -25,2 +23,2 @@ .listen(3000, function() { | ||
}); | ||
{ | ||
"name": "react-lorem-component", | ||
"version": "0.5.3", | ||
"version": "0.6.1", | ||
"description": "A component for React that renders paragraph or list item tags full of lorem ipsum text", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git://github.com/natekross/react-lorem-component" | ||
"url": "git://github.com/martinandert/react-lorem-component" | ||
}, | ||
@@ -19,4 +19,4 @@ "keywords": [ | ||
"author": { | ||
"name": "Nathan Kross", | ||
"email": "natekross@gmail.com" | ||
"name": "Martin Andert", | ||
"email": "mandert@gmail.com" | ||
}, | ||
@@ -28,5 +28,5 @@ "license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/natekross/react-lorem-component/issues" | ||
"url": "https://github.com/martinandert/react-lorem-component/issues" | ||
}, | ||
"homepage": "https://github.com/natekross/react-lorem-component", | ||
"homepage": "https://github.com/martinandert/react-lorem-component", | ||
"dependencies": { | ||
@@ -37,3 +37,3 @@ "seedable-random": "~0.0.1", | ||
"peerDependencies": { | ||
"react": "~0.8.0" | ||
"react": "~0.9.0" | ||
}, | ||
@@ -49,5 +49,4 @@ "devDependencies": { | ||
"reactify": "~0.7.0", | ||
"envify": "~0.2.0", | ||
"react": "~0.8.0" | ||
"react": "~0.9.0" | ||
} | ||
} |
37
spec.js
var assert = require('assert'); | ||
var React = require('react'); | ||
var LoremIpsum = require('./index'); | ||
var render = require('react').renderComponentToString; | ||
assert.matches = function(actual, expected, message) { | ||
if (!expected.test(actual)) { | ||
assert.fail(actual, expected, message, '!~'); | ||
} | ||
}; | ||
describe('react-lorem-component', function() { | ||
it('transfers props', function() { | ||
React.renderComponentToString(LoremIpsum({ className: "lorem-ipsum" }), function(markup) { | ||
assert(/^<div [^>]*?class="lorem-ipsum"/.test(markup)); | ||
}); | ||
var markup = render(LoremIpsum({ className: "lorem-ipsum" })); | ||
assert.matches(markup, /^<div [^>]*?class="lorem-ipsum"/); | ||
}); | ||
@@ -14,14 +21,14 @@ | ||
it('renders lorem ipsum paragraphs wrapped in a DIV tag', function() { | ||
var component = LoremIpsum({ | ||
var component = LoremIpsum({ | ||
count: 2, | ||
words: ['foo'], | ||
sentenceLowerBound: 3, | ||
sentenceUpperBound: 3, | ||
sentenceLowerBound: 1, | ||
sentenceUpperBound: 1, | ||
paragraphLowerBound: 2, | ||
paragraphUpperBound: 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)); | ||
}); | ||
var markup = render(component); | ||
assert.matches(markup, /^<div [^>]+><p>Foo. Foo.<\/p><p>Foo. Foo.<\/p><\/div>$/); | ||
}); | ||
@@ -33,6 +40,5 @@ }); | ||
var component = LoremIpsum({ count: 2, mode: 'list' }); | ||
var markup = render(component); | ||
React.renderComponentToString(component, function(markup) { | ||
assert(/^<ul [^>]+><li>.+<\/li><\/ul>$/.test(markup)); | ||
}); | ||
assert.matches(markup, /^<ul [^>]+><li>.+<\/li><\/ul>$/); | ||
}); | ||
@@ -43,6 +49,5 @@ | ||
var component = LoremIpsum({ count: 2, mode: 'list', ordered: true }); | ||
var markup = render(component); | ||
React.renderComponentToString(component, function(markup) { | ||
assert(/^<ol [^>]+><li>.+<\/li><\/ol>$/.test(markup)); | ||
}); | ||
assert.matches(markup, /^<ol [^>]+><li>.+<\/li><\/ol>$/); | ||
}); | ||
@@ -49,0 +54,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
9630
116
1