mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
24 lines
507 B
JavaScript
24 lines
507 B
JavaScript
import React from 'react';
|
|
|
|
const TestUtils = {
|
|
createContextProvider: function(context) {
|
|
var _contextTypes = {};
|
|
|
|
Object.keys(context).forEach(function(key) {
|
|
_contextTypes[key] = React.PropTypes.any;
|
|
});
|
|
|
|
return React.createClass({
|
|
displayName: 'ContextProvider',
|
|
childContextTypes: _contextTypes,
|
|
getChildContext() { return context; },
|
|
|
|
render() {
|
|
return React.Children.only(this.props.children);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
export default TestUtils; |