coflux
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -39,2 +39,6 @@ 'use strict'; | ||
function buildGranchildDependencies(child) { | ||
// Bail if child is not a component (e.g. a string) | ||
if (!_react2.default.isValidElement(child)) { | ||
return; | ||
} | ||
var childComponent = child.type.nativeComponent; | ||
@@ -41,0 +45,0 @@ |
{ | ||
"name": "coflux", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Component-based Flux", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -353,3 +353,50 @@ jest.autoMockOff(); | ||
}); | ||
it('works with non-element children', () => { | ||
const nodeWithTextChild = ({ test, children, actions }) => { | ||
return ( | ||
<div onClick={actions.triggerUpdate}> | ||
{test} {children} | ||
</div> | ||
); | ||
}; | ||
const NodeWithTextChild = wrap(nodeWithTextChild, { | ||
mapStateToProps() { | ||
return { | ||
test: 'test', | ||
}; | ||
}, | ||
actions: { | ||
triggerUpdate(props, next) { | ||
next({ test: 'bar' }); | ||
}, | ||
}, | ||
}); | ||
const store = { | ||
test: 'foo', | ||
}; | ||
const tree = mount( | ||
<Provider store={store}> | ||
<NodeWithTextChild> | ||
test | ||
</NodeWithTextChild> | ||
</Provider> | ||
); | ||
/* | ||
* simulate the click to update state | ||
*/ | ||
const nodeWrapper = tree.find('[onClick]'); | ||
nodeWrapper.simulate('click'); | ||
/* | ||
* EXPECTATION | ||
*/ | ||
expect( | ||
nodeWrapper.text() | ||
).toBe('bar test'); | ||
}); | ||
}); | ||
@@ -25,2 +25,6 @@ /* | ||
function buildGranchildDependencies(child) : void { | ||
// Bail if child is not a component (e.g. a string) | ||
if (!React.isValidElement(child)) { | ||
return; | ||
} | ||
const childComponent:Object = child.type.nativeComponent; | ||
@@ -27,0 +31,0 @@ |
64075
1797