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

alt-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alt-utils - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

docs/ActionListeners.md

15

lib/ActionListeners.js

@@ -20,7 +20,10 @@ /**

"use strict";
'use strict';
Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true
});
var _functions = require('./functions');
function ActionListeners(alt) {

@@ -36,2 +39,6 @@ this.dispatcher = alt.dispatcher;

ActionListeners.prototype.addActionListener = function addActionListener(symAction, handler) {
if (!(0, _functions.isFunction)(handler)) {
throw new Error('addActionListener() expects a function as the second argument');
}
var id = this.dispatcher.register(function (payload) {

@@ -64,3 +71,3 @@ /* istanbul ignore else */

exports["default"] = ActionListeners;
module.exports = exports["default"];
exports['default'] = ActionListeners;
module.exports = exports['default'];

@@ -33,4 +33,12 @@ /*

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -46,36 +54,50 @@

function bind(Component) {
return _react2['default'].createClass({
getInitialState: function getInitialState() {
return Spec.reduceProps(this.props, this.context);
},
return (function (_React$Component) {
_inherits(ConnectComponent, _React$Component);
componentWillMount: function componentWillMount() {
if (Spec.willMount) Spec.willMount(this.props, this.context);
},
function ConnectComponent(props, context) {
_classCallCheck(this, ConnectComponent);
componentDidMount: function componentDidMount() {
var _this = this;
_get(Object.getPrototypeOf(ConnectComponent.prototype), 'constructor', this).call(this, props, context);
this.state = Spec.reduceProps(props, context);
}
var stores = Spec.listenTo(this.props, this.context);
this.storeListeners = stores.map(function (store) {
return store.listen(_this.onChange);
});
_createClass(ConnectComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
if (Spec.willMount) Spec.willMount(this.props, this.context);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this = this;
if (Spec.didMount) Spec.didMount(this.props, this.context);
},
var stores = Spec.listenTo(this.props, this.context);
this.storeListeners = stores.map(function (store) {
return store.listen(_this.onChange);
});
componentWillUnmount: function componentWillUnmount() {
this.storeListeners.forEach(function (unlisten) {
return unlisten();
});
},
if (Spec.didMount) Spec.didMount(this.props, this.context);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.storeListeners.forEach(function (unlisten) {
return unlisten();
});
}
}, {
key: 'onChange',
value: function onChange() {
this.setState(Spec.reduceProps(this.props, this.context));
}
}, {
key: 'render',
value: function render() {
return _react2['default'].createElement(Component, _extends({}, this.props, this.state));
}
}]);
onChange: function onChange() {
this.setState(Spec.reduceProps(this.props, this.context));
},
render: function render() {
return _react2['default'].createElement(Component, _extends({}, this.props, this.state));
}
});
return ConnectComponent;
})(_react2['default'].Component);
}

@@ -82,0 +104,0 @@

@@ -18,2 +18,5 @@ /**

* return myStore.getState()
* },
* storeDidChange(props) {
* // Optional: do something after the state has been set
* }

@@ -53,4 +56,12 @@ * },

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -73,39 +84,65 @@

var StoreConnection = _react2['default'].createClass({
displayName: 'Stateful' + (Component.displayName || Component.name || 'Container'),
if (typeof Spec.storeDidChange === 'undefined') {
var storeDidChange = function storeDidChange() {}; // no-op
} else if (!(0, _functions.isFunction)(Spec.storeDidChange)) {
throw new Error('connectToStores() expects the storeDidChange() to be a function');
} else {
var storeDidChange = Spec.storeDidChange;
}
getInitialState: function getInitialState() {
return Spec.getPropsFromStores(this.props, this.context);
},
var StoreConnection = (function (_React$Component) {
_inherits(StoreConnection, _React$Component);
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
this.setState(Spec.getPropsFromStores(nextProps, this.context));
},
function StoreConnection(props, context) {
_classCallCheck(this, StoreConnection);
componentDidMount: function componentDidMount() {
var _this = this;
_get(Object.getPrototypeOf(StoreConnection.prototype), 'constructor', this).call(this, props, context);
this.state = Spec.getPropsFromStores(props, context);
var stores = Spec.getStores(this.props, this.context);
this.storeListeners = stores.map(function (store) {
return store.listen(_this.onChange);
});
if (Spec.componentDidConnect) {
Spec.componentDidConnect(this.props, this.context);
this.onChange = this.onChange.bind(this);
}
_createClass(StoreConnection, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
this.setState(Spec.getPropsFromStores(nextProps, this.context));
}
},
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var _this = this;
componentWillUnmount: function componentWillUnmount() {
this.storeListeners.forEach(function (unlisten) {
return unlisten();
});
},
var stores = Spec.getStores(this.props, this.context);
this.storeListeners = stores.map(function (store) {
return store.listen(_this.onChange);
});
if (Spec.componentDidConnect) {
Spec.componentDidConnect(this.props, this.context);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.storeListeners.forEach(function (unlisten) {
return unlisten();
});
}
}, {
key: 'onChange',
value: function onChange() {
this.setState(Spec.getPropsFromStores(this.props, this.context));
storeDidChange(this.state);
}
}, {
key: 'render',
value: function render() {
return _react2['default'].createElement(Component, (0, _functions.assign)({}, this.props, this.state));
}
}]);
onChange: function onChange() {
this.setState(Spec.getPropsFromStores(this.props, this.context));
},
return StoreConnection;
})(_react2['default'].Component);
render: function render() {
return _react2['default'].createElement(Component, (0, _functions.assign)({}, this.props, this.state));
}
});
StoreConnection.displayName = 'Stateful' + (Component.displayName || Component.name || 'Container');
if (Component.contextTypes) {

@@ -112,0 +149,0 @@ StoreConnection.contextTypes = Component.contextTypes;

@@ -9,2 +9,4 @@ 'use strict';

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
exports.withData = withData;

@@ -17,2 +19,4 @@ exports.toDOM = toDOM;

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -22,27 +26,48 @@

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function withData(fetch, MaybeComponent) {
function bind(Component) {
return _react2['default'].createClass({
contextTypes: {
buffer: _react2['default'].PropTypes.object.isRequired
},
var WithDataClass = (function (_React$Component) {
_inherits(WithDataClass, _React$Component);
childContextTypes: {
buffer: _react2['default'].PropTypes.object.isRequired
},
function WithDataClass(props) {
_classCallCheck(this, WithDataClass);
getChildContext: function getChildContext() {
return { buffer: this.context.buffer };
},
_get(Object.getPrototypeOf(WithDataClass.prototype), 'constructor', this).call(this, props);
}
componentWillMount: function componentWillMount() {
if (!this.context.buffer.locked) {
this.context.buffer.push(fetch(this.props));
_createClass(WithDataClass, [{
key: 'getChildContext',
value: function getChildContext() {
return { buffer: this.context.buffer };
}
},
}, {
key: 'componentWillMount',
value: function componentWillMount() {
if (!this.context.buffer.locked) {
this.context.buffer.push(fetch(this.props));
}
}
}, {
key: 'render',
value: function render() {
return this.context.buffer.locked ? _react2['default'].createElement(Component, this.props) : null;
}
}]);
render: function render() {
return this.context.buffer.locked ? _react2['default'].createElement(Component, this.props) : null;
}
});
return WithDataClass;
})(_react2['default'].Component);
WithDataClass.contextTypes = {
buffer: _propTypes2['default'].object.isRequired
};
WithDataClass.childContextTypes = {
buffer: _propTypes2['default'].object.isRequired
};
return WithDataClass;
}

@@ -57,15 +82,31 @@

function usingDispatchBuffer(buffer, Component) {
return _react2['default'].createClass({
childContextTypes: {
buffer: _react2['default'].PropTypes.object.isRequired
},
var DispatchBufferClass = (function (_React$Component2) {
_inherits(DispatchBufferClass, _React$Component2);
getChildContext: function getChildContext() {
return { buffer: buffer };
},
function DispatchBufferClass(props) {
_classCallCheck(this, DispatchBufferClass);
render: function render() {
return _react2['default'].createElement(Component, this.props);
_get(Object.getPrototypeOf(DispatchBufferClass.prototype), 'constructor', this).call(this, props);
}
});
_createClass(DispatchBufferClass, [{
key: 'getChildContext',
value: function getChildContext() {
return { buffer: buffer };
}
}, {
key: 'render',
value: function render() {
return _react2['default'].createElement(Component, this.props);
}
}]);
return DispatchBufferClass;
})(_react2['default'].Component);
DispatchBufferClass.childContextTypes = {
buffer: _propTypes2['default'].object.isRequired
};
return DispatchBufferClass;
}

@@ -105,2 +146,4 @@

data.forEach(function (f) {
if (!f) return;
if (Array.isArray(f)) {

@@ -107,0 +150,0 @@ f.forEach(function (x) {

@@ -29,2 +29,6 @@ 'use strict';

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _connectToStores = require('./connectToStores');

@@ -45,4 +49,4 @@

value: {
alt: _react.PropTypes.obj.isRequired,
stores: _react.PropTypes.array.isRequired
alt: _propTypes2['default'].obj.isRequired,
stores: _propTypes2['default'].array.isRequired
},

@@ -49,0 +53,0 @@ enumerable: true

@@ -6,2 +6,7 @@ 'use strict';

});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
exports['default'] = withAltContext;

@@ -11,2 +16,6 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -16,17 +25,37 @@

var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function withAltContext(flux) {
return function (Component) {
return _react2['default'].createClass({
childContextTypes: {
flux: _react2['default'].PropTypes.object
},
var AltContextClass = (function (_React$Component) {
_inherits(AltContextClass, _React$Component);
getChildContext: function getChildContext() {
return { flux: flux };
},
function AltContextClass(props) {
_classCallCheck(this, AltContextClass);
render: function render() {
return _react2['default'].createElement(Component, this.props);
_get(Object.getPrototypeOf(AltContextClass.prototype), 'constructor', this).call(this, props);
}
});
_createClass(AltContextClass, [{
key: 'getChildContext',
value: function getChildContext() {
return { flux: flux };
}
}, {
key: 'render',
value: function render() {
return _react2['default'].createElement(Component, this.props);
}
}]);
return AltContextClass;
})(_react2['default'].Component);
AltContextClass.childContextTypes = {
flux: _propTypes2['default'].object
};
return AltContextClass;
};

@@ -33,0 +62,0 @@ }

{
"name": "alt-utils",
"version": "1.0.0",
"version": "2.0.0",
"description": "A collection of utils that work with alt.js",

@@ -33,3 +33,6 @@ "main": "index.js",

"sinon": "1.17.1"
},
"dependencies": {
"prop-types": "^15.5.10"
}
}
import { jsdom } from 'jsdom'
import Alt from 'alt'
import React from 'react'
import PropTypes from 'prop-types';
import ReactDom from 'react-dom'

@@ -47,28 +48,32 @@ import ReactDomServer from 'react-dom/server'

const getPropsFromStores = sinon.stub().returns(FooStore.getState())
const getPropsFromStoresStub = sinon.stub().returns(FooStore.getState())
const Child = connectToStores(React.createClass({
statics: {
getStores(props) {
return [FooStore]
},
class ChildClass extends React.Component {
static getStores(props) {
return [FooStore]
}
getPropsFromStores
},
static getPropsFromStores = getPropsFromStoresStub
render() {
return <span>{this.props.x + this.props.y}</span>
}
}))
}
const Parent = React.createClass({
getInitialState() {
return { y: 0 }
},
const Child = connectToStores(ChildClass)
class Parent extends React.Component {
constructor(props) {
super(props)
this.state = { y: 0 }
}
componentDidMount() {
this.setState({ y: 1 })
},
}
render() {
return <Child y={this.state.y} />
}
})
}

@@ -79,3 +84,3 @@ const node = TestUtils.renderIntoDocument(

assert(getPropsFromStores.callCount === 2, 'getPropsFromStores called twice')
assert(getPropsFromStoresStub.callCount === 2, 'getPropsFromStores called twice')

@@ -87,7 +92,7 @@ const span = TestUtils.findRenderedDOMComponentWithTag(node, 'span')

'missing the static getStores() method should throw'() {
const BadComponentOne = React.createClass({
class BadComponentOne extends React.Component {
render() {
return React.createElement('div', null, 'Bad')
}
})
}

@@ -100,16 +105,19 @@ assert.throws(() => connectToStores(BadComponentOne), 'expects the wrapped component to have a static getStores() method')

const LegacyComponent = connectToStores(React.createClass({
statics: {
getStores() {
return [testStore]
},
getPropsFromStores(props) {
return testStore.getState()
}
},
class LegacyClass extends React.Component {
static getStores() {
return [testStore]
}
static getPropsFromStores(props) {
return testStore.getState()
}
render() {
return React.createElement('div', null, `Foo${this.props.delim}${this.props.foo}`)
}
}))
}
const LegacyComponent = connectToStores(LegacyClass)
ReactDom.render(

@@ -123,12 +131,11 @@ <LegacyComponent />

'missing the static getPropsFromStores() method should throw'() {
const BadComponentTwo = React.createClass({
statics: {
getStores() {
return [testStore]
}
},
class BadComponentTwo extends React.Component {
static getStores() {
return [testStore]
}
render() {
return React.createElement('div', null, 'Bad')
}
})
}

@@ -138,17 +145,18 @@ assert.throws(() => connectToStores(BadComponentTwo), 'expects the wrapped component to have a static getPropsFromStores() method')

'createClass() component can get props from stores'() {
const LegacyComponent = React.createClass({
statics: {
getStores() {
return [testStore]
},
getPropsFromStores(props) {
return testStore.getState()
}
},
'es6 Class component can get props from stores'() {
class LegacyComponent extends React.Component {
static getStores() {
return [testStore]
}
static getPropsFromStores(props) {
return testStore.getState()
}
render() {
return React.createElement('div', null, `Foo${this.props.delim}${this.props.foo}`)
}
})
}
const WrappedComponent = connectToStores(LegacyComponent)

@@ -161,30 +169,37 @@ const element = React.createElement(WrappedComponent, {delim: ': '})

'component statics can see context properties'() {
const Child = connectToStores(React.createClass({
statics: {
getStores(props, context) {
return [context.store]
},
getPropsFromStores(props, context) {
return context.store.getState()
}
},
contextTypes: {
store: React.PropTypes.object
},
class ChildClass extends React.Component {
static getStores(props, context) {
return [context.store]
}
static getPropsFromStores(props, context) {
return context.store.getState()
}
render() {
return <span>Foo: {this.props.foo}</span>
}
}))
}
const ContextComponent = React.createClass({
ChildClass.contextTypes = {
store: PropTypes.object
}
const Child = connectToStores(ChildClass)
class ContextComponent extends React.Component {
getChildContext() {
return { store: testStore }
},
childContextTypes: {
store: React.PropTypes.object
},
}
render() {
return <Child/>
}
})
}
ContextComponent.childContextTypes = {
store: PropTypes.object
}
const element = React.createElement(ContextComponent)

@@ -196,15 +211,15 @@ const output = ReactDomServer.renderToStaticMarkup(element)

'component can get use stores from props'() {
const LegacyComponent = React.createClass({
statics: {
getStores(props) {
return [props.store]
},
getPropsFromStores(props) {
return props.store.getState()
}
},
class LegacyComponent extends React.Component {
static getStores(props) {
return [props.store]
}
static getPropsFromStores(props) {
return props.store.getState()
}
render() {
return React.createElement('div', null, `Foo${this.props.delim}${this.props.foo}`)
}
})
}

@@ -268,2 +283,30 @@ const WrappedComponent = connectToStores(LegacyComponent)

'storeDidChange hook is called '() {
let storeDidChange
class ClassComponent4 extends React.Component {
render() {
return <span foo={this.props.foo} />
}
}
const WrappedComponent = connectToStores({
getStores() {
return [testStore]
},
getPropsFromStores(props) {
return testStore.getState()
},
storeDidChange(state) {
storeDidChange = state
}
}, ClassComponent4)
const node = TestUtils.renderIntoDocument(
<WrappedComponent />
)
testActions.updateFoo('Baz')
assert.deepEqual(storeDidChange, {foo: 'Baz'})
},
'Component receives all updates'(done) {

@@ -270,0 +313,0 @@ let componentDidConnect = false

@@ -12,6 +12,7 @@ import React from 'react'

const App = React.createClass({
getInitialState() {
return FooStore.getState()
},
class App extends React.Component {
constructor(props) {
super(props)
this.state = FooStore.getState()
}

@@ -18,0 +19,0 @@ render() {

@@ -7,3 +7,7 @@ import React from 'react'

const App = React.createClass({
class App extends React.Component {
constructor(props) {
super(props)
}
render() {

@@ -10,0 +14,0 @@ return (

@@ -140,3 +140,3 @@ import { jsdom } from 'jsdom'

const TestComponent = React.createClass({
class TestComponent extends React.Component {
render() {

@@ -155,3 +155,3 @@ return (

}
})
}

@@ -195,3 +195,3 @@ const WrappedComponent = withAltContext(flux)(TestComponent)

const TestComponent = React.createClass({
class TestComponent extends React.Component {
render() {

@@ -210,3 +210,3 @@ return (

}
})
}

@@ -416,10 +416,11 @@ const WrappedComponent = withAltContext(flux)(TestComponent);

const El = React.createClass({
getInitialState() {
return { store: TestStore }
},
class El extends React.Component {
constructor(props) {
super(props)
this.state = { store: TestStore }
}
componentDidMount() {
cb = state => this.setState(state)
},
}

@@ -433,3 +434,3 @@ render() {

}
})
}

@@ -528,7 +529,7 @@ const node = TestUtils.renderIntoDocument(<El />)

'passing in a component as a prop'() {
const App = React.createClass({
class App extends React.Component {
render() {
return <strong x={this.props.x} />
}
})
}

@@ -550,25 +551,27 @@ const node = TestUtils.renderIntoDocument(

const View = React.createClass({
class View extends React.Component {
render() {
return <SubView />
}
})
}
const SubView = React.createClass({ render() {
return (
<AltContainer>
<InsideComponent />
</AltContainer>
)
} })
class SubView extends React.Component {
render() {
return (
<AltContainer>
<InsideComponent />
</AltContainer>
)
}
}
const InsideComponent = React.createClass({
class InsideComponent extends React.Component {
render() {
return <span flux={this.props.flux} />
}
})
}
const foo = sinon.spy()
const App = React.createClass({
class App extends React.Component {
render() {

@@ -581,3 +584,3 @@ return (

}
})
}

@@ -584,0 +587,0 @@ const node = TestUtils.renderIntoDocument(<App />)

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