unit testing - How can I access inline style using React findDomNode function? -


i jest test react component, component's inline style changed according different props value.

this example wanna do:

let firstchild = testutils.findrendereddomcomponentwithtag(renderedcomponent, 'div');     expect(firstchild.getdomnode().style).toequal({       fontsize: '20px'     }); 

this component props:

let renderedcomponent = testutils.renderintodocument(       <circleicon         size="small" /> 

and component dom test with:

return (       <div classname="circle-icon" style={boxstyle}>         <span classname={this.props.icon}></span>       </div>     ); 

if can inside boxstyle, can assert test result it.

thanks lot!

actually works.

usage:

firstchild.getdomnode().style.backgroundcolor 

Comments