reactjs - What does react test-utils expect when it refers to ReactComponent tree? -
I am trying to write a test for some of the D3 elements provided through the feedback component, and I Pick up some SVG elements on the page that was hoping to be and check whether they are behaving as expected, check their width.
I am not completely sure whether people are expecting reciprocal documents when they say, the reactive tree.
array scryRenderedDOMComponentsWithClass (ReactComponent tree, string className) I am providing my components through the document:
< Code> var component = TestUtils.renderIntoDocument (& lt; Percentage of Advanced = {75} / & gt;); And I'm successfully checking for a CSS class:
It should provide an element with the class ("progress-cycle" ', Function () {var circle container = test utility.FundanderedDomcomponitivity class (component,' progress-circle '); hope (circle equipment) .toBeDefined ();}); But I do not understand that I need to find some of these / screen methods, which is a vague
Edit:
For more clarification, the provided dom for this component looks like this: < / P>
gt; & lt; svg & gt; & lt; ga & gt; & lt; / ga & gt; & lt; / svg & Gt; & lt; / div & gt; ... and I am trying to find the element.
From what I think, from TestUtils.renderIntoDocument () gives a reactive tree, then you can drag different components from those trees Do the test Are spun.
For example, this test passes for me.
it ( 'response tree requires demonstrates, function () (Var response) (' response / Adons'); var TestUtils = React.addons.TestUtils; var MyComponent = required ( '../ MyComponent.jsx'); var renderedTree = TestUtils.renderIntoDocument (& lt; MyComponent / & Gt;); var renderedMyComponent = hope TestUtils.findRenderedDOMComponentWithClass (render the Gyatry "I-component ') (TestUtils .isDOMComponent (MyComponent render). Tobe (true);});
So if you are only contributed to a component, then it renderedTree of the original
Before That you can check the claim against it, but you still have to find renderedTree inside MyComponent .
Comments
Post a Comment