From 7624d6b5fc9669bb9b9d619f9ffebef575437099 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 16 Nov 2017 19:56:29 -0800 Subject: [PATCH] Add test for system injection with mapStateToProps containers --- test/core/system/system.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/core/system/system.js b/test/core/system/system.js index 2b4990df..9113b2d1 100644 --- a/test/core/system/system.js +++ b/test/core/system/system.js @@ -472,17 +472,18 @@ describe("bound system", function(){ class ContainerComponent extends PureComponent { mapStateToProps(nextState, props) { return { - "abc": "This came from mapStateToProps" + "fromMapState": "This came from mapStateToProps" } } static defaultProps = { - "abc" : "" + "fromMapState" : "" } render() { + const { exampleSelectors, fromMapState, fromOwnProps } = this.props return ( -
{ this.props.abc }
+
{ fromMapState } {exampleSelectors.foo()} {fromOwnProps}
) } } @@ -493,6 +494,15 @@ describe("bound system", function(){ components: { ContainerComponent } + }, + { + statePlugins: { + example: { + selectors: { + foo() { return "and this came from the system" } + } + } + } } ] }) @@ -501,12 +511,12 @@ describe("bound system", function(){ var Component = system.getSystem().getComponent("ContainerComponent", true) const renderedComponent = render( - + ) // Then - expect(renderedComponent.text()).toEqual("This came from mapStateToProps") + expect(renderedComponent.text()).toEqual("This came from mapStateToProps and this came from the system and this came from my own props") }) })