react-outlet
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -0,1 +1,6 @@ | ||
2016-09-19 Version 1.0.5 | ||
* Added Outlet.reset() for easier server-side usage | ||
* Contributed by adamastern | ||
2016-03-12 Version 1.0.4 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "react-outlet", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Transclusion helpers for React.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,3 @@ # React Outlet [![Travis][travis-badge]][travis] [![npm package][npm-badge]][npm] | ||
``` | ||
```jsx | ||
var Outlet = require("react-outlet").Outlet; | ||
@@ -72,3 +72,3 @@ var Plug = require("react-outlet").Plug; | ||
``` | ||
```html | ||
Static Methods: | ||
@@ -79,2 +79,5 @@ | ||
components as the outletId prop. | ||
Outlet.reset() | ||
Reset the Outlet's registry. This was added for server-side React usage. | ||
@@ -81,0 +84,0 @@ Components: |
@@ -270,2 +270,19 @@ jest.autoMockOff(); | ||
}); | ||
it("supports clearing all outlets from the registry", function() { | ||
var id = Outlet.new_outlet_id(); | ||
TestUtils.renderIntoDocument( | ||
<TestDiv> | ||
<Outlet outletId={ id } className="outlet-content" /> | ||
</TestDiv> | ||
); | ||
expect(outlet_registry.outlets.hasOwnProperty(id)).toBeTruthy(); | ||
Outlet.reset(); | ||
expect(outlet_registry.outlets != null | ||
&& typeof outlet_registry.outlets === "object" | ||
&& !Array.isArray(outlet_registry.outlets) | ||
).toBeTruthy(); | ||
expect(Object.keys(outlet_registry.outlets).length).toEqual(0); | ||
}); | ||
}); | ||
@@ -272,0 +289,0 @@ |
@@ -62,2 +62,6 @@ function OutletRegistry() { | ||
OutletRegistry.prototype.reset = function(){ | ||
this.outlets = {}; | ||
}; | ||
module.exports = new OutletRegistry(); |
@@ -6,3 +6,4 @@ var React = require("react"); | ||
statics: { | ||
new_outlet_id: registry.generate_id.bind(registry) | ||
new_outlet_id: registry.generate_id.bind(registry), | ||
reset: registry.reset.bind(registry) | ||
}, | ||
@@ -9,0 +10,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
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
26402
14
410
112