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

react-outlet

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-outlet - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

CHANGELOG.txt

@@ -0,1 +1,6 @@

2015-07-13 Version 1.0.2
* If a plug is either not mounted or has falsey children, the outlet should
render as null
2015-02-01 Version 1.0.1

@@ -2,0 +7,0 @@

3

package.json
{
"name": "react-outlet",
"version": "1.0.1",
"version": "1.0.2",
"description": "Transclusion helpers for React.js",

@@ -32,2 +32,3 @@ "main": "index.js",

"jshint": "^2.6.0",
"react": "^0",
"react-tools": "^0.12.2"

@@ -34,0 +35,0 @@ },

@@ -43,6 +43,10 @@ jest.autoMockOff();

var PlugWrap = React.createClass({
getInitialState: function() { return { content: undefined }; },
getInitialState: function() { return { content: undefined, renderPlug: false }; },
render: function() {
return <Plug outletId={ this.props.outletId }>{ this.state.content }</Plug>;
if (this.state.renderPlug) {
return <Plug outletId={ this.props.outletId }>{ this.state.content }</Plug>;
} else {
return null;
}
}

@@ -58,9 +62,35 @@ });

var outlet_content = TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
expect(outlet_content.getDOMNode().textContent).toBe("");
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
}).toThrow();
var plug_wrap = TestUtils.findRenderedComponentWithType(tree, PlugWrap);
plug_wrap.setState({ renderPlug: true });
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
}).toThrow();
plug_wrap.setState({ content: "foobar" });
var outlet_content = TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
expect(outlet_content.getDOMNode().textContent).toBe("foobar");
plug_wrap.setState({ content: undefined });
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
}).toThrow();
plug_wrap.setState({ content: <b>testing</b> });
outlet_content = TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
expect(outlet_content.getDOMNode().textContent).toBe("testing");
plug_wrap.setState({ renderPlug: false });
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree, "outlet-content");
}).toThrow();
});

@@ -80,12 +110,19 @@

var tree = TestUtils.renderIntoDocument(<PlugWrap outletId={ id } />);
var tree2 = TestUtils.renderIntoDocument(<Outlet outletId={ id } className="outlet-content" />);
var outlet_content = TestUtils.findRenderedDOMComponentWithClass(tree2, "outlet-content");
expect(outlet_content.getDOMNode().textContent).toBe("");
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree2, "outlet-content");
}).toThrow();
var plug_wrap = TestUtils.findRenderedComponentWithType(tree, PlugWrap);
plug_wrap.setState({ content: "foobar" });
var outlet_content = TestUtils.findRenderedDOMComponentWithClass(tree2, "outlet-content");
expect(outlet_content.getDOMNode().textContent).toBe("foobar");
expect(outlet_content.getDOMNode().textContent).toBe("foobar");
plug_wrap.setState({ content: undefined });
expect(function() {
TestUtils.findRenderedDOMComponentWithClass(tree2, "outlet-content");
}).toThrow();
});

@@ -215,4 +252,3 @@

.findRenderedComponentWithType(outlet_tree_2, Outlet)
.getDOMNode()
.textContent).toBe("");
.getDOMNode()).toBeNull();

@@ -219,0 +255,0 @@ // outlet should still exist in the registry

@@ -33,3 +33,7 @@ var React = require("react");

update: function(children) {
this.setState({ children: React.createElement('div', this.props, children) });
if (children) {
this.setState({ children: React.createElement('div', this.props, children) });
} else {
this.setState({ children: null });
}
},

@@ -36,0 +40,0 @@

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