Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should render component', () => {
expect(TestUtils.isDOMComponent(component)).to.equal(true);
});
assertText(text) {
const re = new RegExp(text, 'g')
const first = this.first()
const textContent = isDOMComponent(first) ? first.textContent : findDOMNode(first).textContent
const all = _.words(textContent, re)
if (all.length !== 1) {
throw new Error(`Did not find exactly one match (found: ${all.length}) for text: "${text}"`)
}
return true
}
}
node
);
let content;
expect(component.state).toEqual({
styles: {
top: 0,
left: -5000,
height: 0,
opacity: 0,
width: 0
}
});
content = component.main;
expect(TestUtils.isDOMComponent(content)).toBeTruthy();
component = ReactDOM.render(
,
node,
() => {
expect(component.state.styles.opacity).toBe(1);
done();
}
);
});
var rw = TU.renderIntoDocument(
);
var svg = TU.findRenderedDOMComponentWithTag(
rw,
"svg"
);
t.ok(TU.isDOMComponent(svg), "svg rendered to DOM");
var svg_dom = ReactDOM.findDOMNode(svg);
var d3svg = d3.select(svg_dom);
var num_series = randXYGrid.chartProps._grid.cols * randXYGrid.chartProps._grid.rows;
var num_vals = _.reduce(randXYGrid.chartProps.data, function(numVals, d) {
return numVals + d.values.length;
}, 0);
var grids = d3svg.selectAll("g.grid-chart-block");
t.equal(num_series, grids[0].length, "number of rendered bar grid blocks correct");
//TODO: Check that correct types are rendererd
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(rw).parentNode);
t.end();
function traverse(c, node) {
if (!c || isDOMComponent(c)) {
return;
}
const newNodeName = typeof c === 'function' ? c.name : c.constructor.name;
node.children.push({
name: newNodeName,
children: []
});
const ccc = getRenderedChildOfCompositeComponent(c);
if (isDOMComponent(ccc)) {
React.Children.forEach(ccc.props.children, function traverseChildWithNode(child) {
if (child.type) {
traverse(child.type, getNode(node, newNodeName));
}
});
} else {
traverse(ccc, getNode(node, c.constructor.name));
}
}
function traverse(c, node) {
if (!c || isDOMComponent(c)) {
return;
}
const newNodeName = typeof c === 'function' ? c.name : c.constructor.name;
node.children.push({
name: newNodeName,
children: []
});
const ccc = getRenderedChildOfCompositeComponent(c);
if (isDOMComponent(ccc)) {
React.Children.forEach(ccc.props.children, function traverseChildWithNode(child) {
if (child.type) {
traverse(child.type, getNode(node, newNodeName));